Record Versioning

Overview

The goal is to have the ability to track any changes in the system at the database level. This goal may be achieved by log tables and database triggers. The log tables are copies of the tables to be tracked with some additional fields, while the database triggers save the records before all changes.

The sample below shows the solution on the FileTypeRef table.

The log table

The log table is the copy of the original table with the following additional fields:

It is recommended to set the primary key of the original table to 'not null' and to set an index on it in the log table:

The Database Triggers

Note that the SQL command delimiter must be changed at issuing the 'CREATE TRIGGER' commands because the usual delimiter ';' is part of the command itself:

Notes

RecordVersioning (last edited 2010-05-12 09:43:28 by 183-56-252)

Copyright 2008-2014, SoftXS GmbH, Switzerland