title: Generic version control strategy for select table data within a heavily normalized database
body: <p>Sorry for the long winded title, but the requirement/problem is rather specific.</p>
  
  <p>With reference to the following sample (but very simplified) structure (in psuedo SQL), I hope to explain it a bit better.</p>
  
  <pre><code>TABLE StructureName {
    Id GUID PK,
    Name varchar(50) NOT NULL
  }
  
  TABLE Structure {
    Id GUID PK,
    ParentId GUID,                 -- FK to Structure
    NameId GUID NOT NULL           -- FK to StructureName
  }
  
  TABLE Something {
    Id GUID PK,
    RootStructureId GUID NOT NULL  -- FK to Structure
  }
  </code></pre>
  
  <p>As one can see, Structure is a simple tree structure (not worried about ordering of children for the problem). StructureName is a simplification of a translation system. Finally 'Something' is simply something referencing the tree's root structure.</p>
  
  <p>This is just one of many tables that need to be versioned, but this one serves as a good example for most cases.</p>
  
  <p>There is a requirement to version to any changes to the name and/or the tree 'layout' of the Structure table. Previous versions should always be available.</p>
  
  <p>There seems to be a few possibilities to tackle this issue, like copying the entire structure, but most approaches causes one to 'loose' referential integrity. Example if one followed this approach, one would have to make a duplicate of the 'Something' record, given that the root structure will be a new record, and have a new ID.</p>
  
  <p>Other avenues of possible solutions are looking into how Wiki's handle this or go a lot further and look how proper version control systems work.</p>
  
  <p>Currently, I feel a bit clueless how to proceed on this in a generic way.</p>
  
  <p>Any ideas will be greatly appreciated.</p>
  
  <p>Thanks</p>
  
  <p>leppie</p>