It is recommended that foreign keys save id or code.
Today, when working on a project, I encountered importing a batch of data, but because the basic files (only user files, departmental files, etc.) have been re-imported, the foreign key id of the document can not be associated with the previous basic file data, which would not have happened if the foreign key had used code at that time.
In addition, it is suggested that there is a special table to manage the code prefix of each document.
It's better to id, save all the codes, all right.