I'm trying to use a simple mysql database but tweak it so that every field is backed up up to an indefinite number of versions. The best way I can illustrate this is by replacing each and every field of every table with a stack of all the values this field has ever had (each of these values should be timestamped). I guess it's kind of like having customized version control for all my data..
Any ideas on how to do this?
Database version control is the practice of tracking every change made to the database by every team member. Like application version control, database version control acts as a single source of truth. It empowers you with complete visibility, traceability, and continuous monitoring of the changes in your database.
In MySQL Command Line Client, enter the following command: SHOW VARIABLES LIKE 'version'; The MySQL version will be shown instantly.
Open SQL Server Management Studio and connect to a SQL Server instance. Right-click on your database in the Object Explorer pane and select "Connect to Version Control". This will open the "Connect Database to Version Control" dialog. Copy the https repository path from GitHub and paste it into VersionSQL.
The usual method for "tracking any changes" to a table is to add insert/update/delete trigger procedures on the table and have those records saved in a history table.
For example, if your main data table is "ItemInfo" then you would also have an ItemInfo_History table that got a copy of the new record every time anything changed (via the triggers).
This keeps the performance of your primary table consistent, yet gives you access to the history of any changes if you need it.
Here are some examples, they are for SQL Server but they demonstrate the logic:
My Repository table My Repository History table My Repository Insert trigger procedure My Repository Update trigger procedure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With