ms access - Audit table design suggestions -


is correct approach? suggestions make better?

  1. below screenshot of employee table , shadow table tl_name , dept fields may change , using shadow table track changes.

  2. records inserted/updated in main table , gets copied shadow table of data macro.

  3. all records in shadow table have approved/rejected superuser

  4. main table have updated alignment , shadow table have entire history of changes employee.

  5. when record added/updated in main table via userform, copy of record created in shadow table has approved admin.

  6. when record added/updated in main table via userform, is_active field set false , once approved admin updated true.

enter image description here

as understand requirements:

  • changed/inserted data should visible everyone, visible flag un-approved data.
  • this reasonable, if work under assumption majority of changes correct , approved (hopefully true ;) ).

i think missing:

  • if change rejected, data in main table should automatically reverted recent approved state.
  • otherwise main table stays in (sort of) undefined state forever, is_active = false , (apparently) wrong data.

this can done audit table design. find latest approved entry emp pk, , use data.

but if number of columns audited may change in future, might consider approach 2 tables, in project: https://autoaudit.codeplex.com/documentation

auditheader table

this table inserted 1 row everytime 1 record inserted, updated or deleted in table has been setup use autoaudit system.

auditdetail table

this table related auditheader , inserted 1 row each column changed during insert or update operation , each column during delete operation.

if save old + new values every change, can revert "old" state current audit entry.

and structure change of main table (or if decide e.g. users can edit emp_name too) doesn't need structure change of audit table, because every audited column in main mapped row in auditdetails instead of column.

edit: additional advantage:

in sample data have marked changed values in red. access table doesn't work that. if want keep information ("which column(s) edited?"), need additional column in audit table.

this covered auditdetail, since contains each change old + new value.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -