开发者

MySQL database changelog (how to make one?)

开发者 https://www.devze.com 2023-02-03 18:46 出处:网络
Hey I was wondering if it was possible to maintain a changelog for a mysql database? I have 6 tables and was wondering if there was an efficient way to make shadow tables for each one that will denote

Hey I was wondering if it was possible to maintain a changelog for a mysql database? I have 6 tables and was wondering if there was an efficient way to make shadow tables for each one that will denote the changes made. Im not sure if I am explaining it well but heres an example:

Action: Table "users" user=john with password = 'password' Action in background: Table "users_shadow" user=john with password = 'password' action=added开发者_JAVA百科

Then if the password changes. The table user only changes the password for that row but the action in background talbe says in new row "users_shadow" user=john with password='password1' action=passwordmodified"

So now I have 2 rows with user john in the shadow table where I can look and see all modifications made to that table.

Sorry, kinda hard to explain, but is this possible?


This is definitely possible -- it just requires code. That said, depending on what you want this for, the binary logs may already meet your needs. Read up on them before you write your own logging code.

0

精彩评论

暂无评论...
验证码 换一张
取 消