CCAFS / ccafs-ap

CCAFS P&R is a platform to assist in the planning and reporting of CCAFS-related research projects. Migrated from https://code.google.com/p/ccafs-ap/
GNU General Public License v3.0
2 stars 1 forks source link

Save who and when make changes in the platform #337

Closed hernandcb closed 9 years ago

hernandcb commented 9 years ago

We need to design and implement the changes in the database that will allow to keep record about who made the changes and when they did it.

To do this we need first:

hernandcb commented 9 years ago

To make this change I have followed some of the guidelines given in this blog

The following changes were made:

  1. Added additional fields to the tables that will have a history (See image with a table as example at the bottom).
    • is_active
    • active_since
    • active_until
    • modified_by
    • action
  2. It was created a history database which contains a table for each table that will keep a history of changes.
  3. There were created triggers to insert the data on the history database each time the table has any change. Those triggers were created following the steps given in this stackoverflow answer

image