Hello. There is a task: to keep deletions and updates of records in all tables. The project is written in yii. DBMS: mysql. There are 8 tables. Content of one log:
[deleted / updated] an entry in the table [table_name] with values (former) [field_name: value, ...]. Change author: [id_user]
What solutions can you offer?
This is what comes to my mind:
1. Triggers. But they disappear, because I can not get who the author of the changes, i.e. who is authorized - authorization is stored in the session.
2. The teacher failed to prove that this can be done through daily backups of the database and enable logging of all queries to the database to track what was happening with it. So it disappears.
3. It seems the most logical so far is to hang the behiwers on the yii model. In them, generate the desired row and write this row to the database table.
4. Just in every place of the code where something is deleted or updated to write a log. IMHO, ugly option.
Purpose: of course, minimal gestures and picking the code)