Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've seen two approches to this problem...
  1. Generic ID vs. Specific ID

    The principle here is that you still use whatever unique identifiers you would without versioning, and use those in whatever mapping tables / foreign keys you need -- call those your Specific IDs (specific to a particular version of the object). On top of that you have additional information that maps a Generic ID (generic for the object, regardless of version) to the currently "live" specific object, who has the generic checked out, etc.... Most of your clients will only ever use the Generic IDs, the only time any one ever needs to worry about a Specific ID is when they want to revert to a previous version, or make a "future" version "live"

  2. Live tables vs Archive tables

    Again, use your normal schema with your normal unique IDs, but you add an additional "archival" table that flattens all of your data (maybe as an XML doc in a text field) and keeps track of the versioning info ... this is really only usefull for keeping a historic log. When making a new version, flatten the current one first and archive it. If anybody wants to "restore" an old version, de-flatten it.

Both methods have complexities. You have to think long and hard in advance about what makes up a single "object", what is it people "lock", how do you deal with related objects, and adding/removing/modifing relationships in different versions. As long as you do a good job of picking your rules in advance, either method can work.


In reply to Re: Version Control in Database Applications by hossman
in thread Version Control in Database Applications by samtregar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found