Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Version Control in Database Applications

by lachoy (Parson)
on Jun 11, 2002 at 03:24 UTC ( [id://173377]=note: print w/replies, xml ) Need Help??


in reply to Version Control in Database Applications

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

Replies are listed 'Best First'.
Re: Re: Version Control in Database Applications
by samtregar (Abbot) on Jun 11, 2002 at 05:05 UTC
    That's a very intersting suggestion. It hadn't occurred to me to implement versioning with something as simple as Storable. I think this may be the winner. I doubt I'll need to implement more than view() and revert() on past versions. Both of which would be easy to implement with a frozen object.

    Thanks!

    -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://173377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-26 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found