Storing Drupal SQL in Git
I have a drupal site, and I am storing the codebase in a git repository. This seems to be working out well, but I’m also making changes to the database. I’m considering doing periodic dumps of the database and committing to git. I had a few questions about this.
If I overwrite the file, will git think it is a brand new file or will it recognize that it is an altered version of the same file.
- Run custom database scripts in Jenkins
- Capistrano Deploy Wipes Database?
- Do you use source control for your database items?
- What's a good way (or tool) to version control a SQLite database (schema only)?
- How to version control SQL Server databases?
- How can I put a database under git (version control)?
Will this potentialy make my repo huge (the database is 16mb)
Can I zip this file? or will this mess Git up … the zipped version is only 3mb
Any other suggestions?
4 Solutions collect form web for “Storing Drupal SQL in Git”
If you have enough space, a non-compressed dump in source control is pretty handy because you can compare using a diff program what rows were added/modified/deleted.
Another solution is to use the features module which is supposed to capture drupal config in code. It stores this captured data as a feature module which you can put into version control.
For my database applications, I store scripts of DDL statements (like
CREATE TABLE) in some sort of version control system. These scripts sometimes include static “seed” data as well. All the version control systems I use are good at recognizing differences in these files, and they are much smaller than the full database with data.
For the dynamically-generated data, I store backups (e.g. from
mysqldump) in an appropriate location (depending on the importance of the data, that may include offsite backups).
1) It’s all text, so GIT will just see it as it would any other file.
2) No, due to the above it should add 16mb to the repo (or less, due to GITs own compression), it won’t add a new file every time, just the changes, so the repo will change by the size of the additions to the repository
3) No, or GIT won’t be able to see the differences – GIT does it’s own compression anyway