Storing Drupal SQL in Git

I have a drupal site and I store the code base in a git repository. This seems to work well, but I am also making changes to the database. I am considering creating periodic database dumps and committing to git. I had a few questions about this.

  • If I overwrite the file, git will think it is a completely new file, or it will find out that it is a modified version of the same file.

  • Will this potential make my repo huge (16 MB database)

  • Can I get this file? or will this mess git up ... the zipped version is only 3mb

  • Any other suggestions?

+6
source share
4 answers

If you have enough space, an uncompressed dump in the source control is quite convenient, because you can use the diff program to compare which lines were added / changed / deleted.

+5
source

Another solution is to use a function module, which should capture the drupal configuration in the code. It saves this data as a function module that you can use in version control.

+1
source

For my database applications, I store DDL statement scripts (e.g. CREATE TABLE ) in some version control system. These scripts sometimes also include static "seed" data. All the version control systems that I use are well versed in the differences in these files, and they are much smaller than a complete database of data.

For dynamically generated data, I store backups (for example, from mysqldump ) in the appropriate place (depending on the importance of the data, which may include offline backups).

0
source

1) All text, so GIT will just see it, like any other file.

2) No, because of the above, he should add 16 mb to the repo (or less due to his own GIT compression), he will not add a new file every time, just change, so the repo will change to the size of the additions to the repository

3) No or GIT will not be able to see the differences - does GIT have its own compression anyway

0
source

Source: https://habr.com/ru/post/888569/


All Articles