I uise a status flag column in the DB, so that the current version has the
status "Current" and all the previous versions have the status "Archive."
This makes selecting the current version so much easier and avoids extra
tables etc.

-----Original Message-----
From: Hugo Ahlenius [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 6 October 2004 12:32
To: CF-Talk
Subject: versioning of db records

Hi all,

I have a little rdbms question:

Let's say I am creating a simple CMS and I want to be able to keep the
history of changes (versioning).

A typical record in the main content table would have things like id, title,
body text and timestamp, the latter would be when it was saved, and getting
the latest record would be the "current" version.

For one page to get the "current" version, this is simple to query to just
get the latest record, but it it will be a little more complicated to do
aggregated functions (i.e. get the latest records of all pages).

To make this smoother, there are a number of ways to do this:
* Have a lookup-table of the latest records (maintained by triggers or in
the app, on insert)
* Have the above in a persistance layer in the application (i.e. an array in
app scope)
* keep the "history" (old versions) in a separate table (maintained by
triggers?)
* super-complicated: create a parent-child relation between each record...

A
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to