The document contains subdirectories, and subdirectories contain subdirectories. Should I use a subtable or a table to complete?

my project is to do document management, as long as the content of the document is modified, it is necessary to generate a new version, the old version and the new version can be viewed. Now there is a situation where the structure of the data meta document is

1.
2.
3.
4.
    4.1 
      4.1.1 
          :...
          :...
          ... : ...
    4.2 
5. 

its structure is like this. I now take 123 as a field in a document table, and then split out the catalog of 4 to make a table. The table structure is the parent id and the name (because the directory may be added, for example, 4.1.1.1), and the specific data element information is a table (the table structure is the field of the parent id plus the data element), all of which are associated through the parent id. Confirm which directory / data element belongs to. Then the function is that when the content of the document is modified, the original will be saved, a new version number will be generated, and you can view the contents of the previous version of the document later. Now the problem is, if there is no split, then directly copy it all and then modify it, but now if you split the table, once the document table is copied, the parent id, in the parent id, table of the catalog table, the child catalog table in the parent id, data element table, has to be added because of the change of the parent id, so in this case, how can you achieve so many parent id modifications?

I thought of a way: in the catalog table and data element table to add a field, in addition to their own parent id, plus an ancestor id (document id), through the document id to distinguish which version belongs to which version, but this also seems to be a problem, the copied catalog table, data element table in the parent id points to the previous version of the corresponding id, just the ancestor id has changed.
is very distressing, but I shouldn"t have designed the split table in this way. Thank you very much for taking up a few minutes of your time.

question 1: how should I split the table, or not split it, and just use one (there will be a problem with one directly. If there are 100 items under the subdirectory, it will be paged at the front end. Can I paginate the records under the subdirectory? for example, I only want articles 11 to 20 under this directory)?

question 2: if you split the table, how can you make so many changes to the associated parent id in this case?

Mar.02,2021
Menu