I am developing a web application with mysql, and I have several tables including user and article.
As I would like to record the user that has updated the selected article, I thought about three possibilities:
In my opinion, the third one is redundant, and the first one badly conceptualised (and only the last change is kept). Even though the second one appears to be good for only one table (article), I am afraid it gets more complicated and very slow if changes must be saved for more than 30 tables -- that means the changes table would have 30 foreign key(?!)
What is the best way? What is your opinion about it?
MySQL has a feature called the Audit Log for this purpose. The idea is that the "audit" which is a series of events for data changes, is written to a log file outside the database. That way you can inspect the log for changes, you can see multiple changes to the same data, you can expire the logs, and so on.
The audit log requires a plugin implementation to do its job. MySQL makes an enterprise audit plugin, but it's not free—you have to be a paying customer to get MySQL Enterprise.
There are a few free alternatives for audit log plugin implementations, too.
You might like to try the Percona Audit Log Plugin. This is an optional plugin that is shipped with Percona Server (a branch of MySQL Community Edition). You just have to enable the plugin.
Documentation for installation and configuration: https://www.percona.com/doc/percona-server/5.7/management/audit_log_plugin.html