Been tasked with making an "Activity Log" or "History Page" for database transactions for our app, and I'd like to explore if it's possible to do this without touching the app itself much, except for display purposes.
Building off from this question (which I've had problems with), which makes use of TRIGGERS
, is there a way to combine that with some form of query watcher, so that instead of having to use a history table per existing table, we can instead make use of a single history table that might look something like this?:
id table_name column_modified action data_before_modify date_modified
1 game_data season_data "insert" "beta season" NOW()
Something like this?
DROP TRIGGER IF EXISTS game_data_insert;
CREATE TRIGGER game_data_insert AFTER INSERT ON game_data FOR EACH ROW
INSERT INTO history_table <Column_modified> "insert", <Data?>, NOW()
We're using MySQL on Amazon Web Service's RDS, if it means anything.