I've actually had the idea (but no motivation in the way of a project) to do this in SPOPS. This would take the form of an extra table:

CREATE TABLE versions ( class varchar(75) not null, object_id varchar(255) not null, version numeric(8,2) not null, object_data blob not null, primary key( class, object_id, version ) )

(There would likely be problems with the width of this primary key but I'd probably restrict the object_id to 150 characters or so.... implementation issue.)

After every update that happens to the object, we create a rule that saves the object state to the database with an incremented version number using Storable if you can be Perl-only, XML if you want to be cross-platform. Fetching all versions of an object would be simple, and in the (hopefully unlikely) event of a primary key modification, we can do an update to ensure the information is migrated properly.

Having a single table with all versions is attractive as long as you don't need to search on a feature of the versioned content -- for instance, finding all users that at one time had a first name of 'Steve'. It also insulates you from future schema changes, since you don't care about the schema at all.

I'd think you could also do this using whatever persistence framework you want with something like Class::Observable or Class::Trigger.

Chris
M-x auto-bs-mode


In reply to Re: Version Control in Database Applications by lachoy
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.