Hi All,
Can anyone please advise on the best approach for copying records for archiving purposes.
Scenario:
I need to update records that meet criteria, but the user may later need to see the original record, what changes took place and the updated record.
My thoughts were to have:
tbl_MyData - Main 'live' data table
tbl_MyRules - Table of rules (with criteria & updates needed)
tbl_MyChangedData - Table to copy the impacted records to before making changes
tbl_MyChangesLog - table to capture basic details of the changes (tbl_MyData.ID, tbl_MyRules.ID, tbl_MyChangedData.ID)
The above will provide the current data in tbl_MyData, with a backup of the related record in it's 'previous' data state in tbl_MyChangedData (which could create a 1 to many relationship, if multiple rules apply to 1 record). What rules were applied can be viewed in tbl_MyChangesLog.
Now, whilst this doesn't create a true 'duplicate' record, many fields may not have changed. So with normalisation/record duplication in mind, what is the best practice approach?
I've thought of not having tbl_MyChangedData & changing the log to record by field changed (eg field name, change from, changed to), though this will require extra coding to recreate the 'original' data view by undoing the changes.
Also, it's worth mentioning that the users operate on a monthly cycle and when a month is completed the database is archived and the above tables (except tbl_MyRules) effectively have all records deleted.
Thanks in advance
Tooley
Can anyone please advise on the best approach for copying records for archiving purposes.
Scenario:
I need to update records that meet criteria, but the user may later need to see the original record, what changes took place and the updated record.
My thoughts were to have:
tbl_MyData - Main 'live' data table
tbl_MyRules - Table of rules (with criteria & updates needed)
tbl_MyChangedData - Table to copy the impacted records to before making changes
tbl_MyChangesLog - table to capture basic details of the changes (tbl_MyData.ID, tbl_MyRules.ID, tbl_MyChangedData.ID)
The above will provide the current data in tbl_MyData, with a backup of the related record in it's 'previous' data state in tbl_MyChangedData (which could create a 1 to many relationship, if multiple rules apply to 1 record). What rules were applied can be viewed in tbl_MyChangesLog.
Now, whilst this doesn't create a true 'duplicate' record, many fields may not have changed. So with normalisation/record duplication in mind, what is the best practice approach?
I've thought of not having tbl_MyChangedData & changing the log to record by field changed (eg field name, change from, changed to), though this will require extra coding to recreate the 'original' data view by undoing the changes.
Also, it's worth mentioning that the users operate on a monthly cycle and when a month is completed the database is archived and the above tables (except tbl_MyRules) effectively have all records deleted.
Thanks in advance
Tooley