Answer the question
In order to leave comments, you need to log in
Database (website) version control
As we all know, version control allows us to get a program of any version (for any date), so to speak, to see what the program code was at one time or another.
It would be interesting to know if there is something similar for sites?
Those. I would like to be able to see what my site was like at any given time.
Let's say drupal - it consists of a software part (drupal developers keep it under version control in general)
+ plugins (in fact, the same code is not a problem to put under version control)
+ user content along with its settings (here, as I understand it is not easy
) ideas the task is reduced to that under control of versions there was a database mySQL.
Or maybe this is done by abandoning MySQL in favor of some more advanced system?
I would welcome any thoughts on this topic.
Upd. Apparently a SQL database with version control support would be the nicest solution. Are there any at all?
Answer the question
In order to leave comments, you need to log in
1. Dump the database.
2. Turn on database query log.
3. Every time you change the log (or at certain intervals), make commits.
4. Periodically make a new database dump, clear the log and commit it.
To restore to a specific state:
1. Restore all files through the version control system, including dump and log.
2. Upload the dump to the database.
3. Execute query log.
As a result, the base is brought to the state at the desired moment.
For the database structure, everything is very simple. You put the database creation sql script under SVN and then any changes to the database must go through this file. Also, in SVN, you can store sequential SQL scripts that directly change the database: alter, update, etc.
Well, there is an obvious option: remember all queries that change the database and apply them to the first backup made before the required date. In fact, the request is a diff, and its execution is a commit.
With a large number of modifying requests, it is of little use, of course.
Well, if your site is not very large, then you can simply install a cron that makes a kind of backup at a certain frequency and simply store files, including database files. But if the site is large (such as file sharing), then it’s more difficult. In this case, it will be possible to simply write such a program that saves only new and updated files to the new archive (for example, by excluding the date the file was modified relative to the latest version of the backup)
I doubt that such databases exist. In MySQL and PostgreSQL, this is definitely not the case. You were rightly suggested that you either need to keep a log of all queries to the database, there is no other solution if the ability to see literally any change is important to you.
Or switch from Drupal to something more advanced. For example, there are several applications for Django that implement versioning.
For the muscle database, it is enough to enable the binary log and already play from it.
It seems like Drupal supports node versioning out of the box.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question