Exist a good extension or similar to create a history of changes in all (or most) tables?
i know i can put my code in function beforeSave() in any model, but i need something more reusable and professional.
in my mind i have the structure below.
table history id, id_user, table_name, change_message, date
1, 25, dbo_address, update(postal_code: old value = 5500, new value: 5501), added(street: Street with no name), 2021-04-04 18:30:00
I think it makes more sense to capture data change history using database trigger code, if you’re using a RDMBS. If you want your app user to see a history of changes, you can always make a view to the history table.
In SQL Server, you can use SYSTEM_USER from the trigger code. I think Oracle has a similar special variable but I forget what it is, if I ever knew. I don’t know about MySql. Of course it kind of depends on how you’re authenticating, so your experience may vary.