Hi all,
I would like to create a single table which will be used as a history table for any inserts, updates, deletes to all other tables in the DB, without using PHP.
For example.
id, table, old, new, timestamp, user
Using triggers, is there a way to serialise the contents of the OLD and NEW rows so they can be entered into the history table?
Can you create a trigger which will run on any update to any table? If yes, then can you reference the table it is actually amending? If not, then I'll have to create a trigger for each table.
User will come from the NEW record, which will have a last_edited_by field set.
I would like to create a single table which will be used as a history table for any inserts, updates, deletes to all other tables in the DB, without using PHP.
For example.
id, table, old, new, timestamp, user
Using triggers, is there a way to serialise the contents of the OLD and NEW rows so they can be entered into the history table?
Can you create a trigger which will run on any update to any table? If yes, then can you reference the table it is actually amending? If not, then I'll have to create a trigger for each table.
User will come from the NEW record, which will have a last_edited_by field set.