D
D
Dmitry2017-10-20 07:24:07
git
Dmitry, 2017-10-20 07:24:07

How to ensure database consistency when moving between git branches?

There is a project in which database migration is used (and where is it not used? ;)).
Tell me how (with what help) to ensure the correct structure of the test database for any git checkout?
It is clear that the question is not related to migration as such, because it is impossible to do migrate:rollback - some columns may be deleted and they will not be filled with information when returning.
What's the best way to do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Kuznetsov, 2017-10-20
@dlnsk

I think the easiest way for you is to use docker/vagrant/i/n, i.e. virtual environment.
You pull a branch, start a virtual machine under it, the base is deployed there, it sits, the necessary migrations are rolled, and you calmly work further. More or less like this.
I advise you to look in this direction.
Otherwise, you will either spend a lot of time on bringing the database to the desired form, or spawn a bunch of databases on the dev-machine for the corresponding branches - which is also a so-so solution.

C
cicatrix, 2017-10-20
@cicatrix

In the Entity Framework, you can manage migrations and, as a result, version the database.
True, to tie it to an already finished project is a separate song.

R
RuJet, 2017-10-28
@RuJet

In Drupal 7, you can do /update.php and the changes in the database structure will roll over. True, not all and not always :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question