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.

  1. 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.

  2. Run custom database scripts in Jenkins
  3. Capistrano Deploy Wipes Database?
  4. Do you use source control for your database items?
  5. What's a good way (or tool) to version control a SQLite database (schema only)?
  6. How to version control SQL Server databases?
  7. How can I put a database under git (version control)?
  8. Will this potentialy make my repo huge (the database is 16mb)

  9. Can I zip this file? or will this mess Git up … the zipped version is only 3mb

  10. Any other suggestions?

  • Convert an SVN repository to git with reposurgeon without creating .gitignore files?
  • git config: “remote.origin.push” vs “push.default”
  • Where do piped files go on Windows?
  • Is there a way to add a custom crypto algorithm into nodejs crypto module? How?
  • How do I SVN-commit multiple git-svn repositories simultaneously?
  • git checkout -f master VS git reset
  • 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

    Git Baby is a git and github fan, let's start git clone.