Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you handle Doctrine Migrations when using Git?

I have a Zend Framework / Doctrine 1.2 project that is source controlled by git. How do you keep track of migration classes when switching from branch to branch in git?

For example

In branch A I have a migration class file (038_version.php)

In branch B I have a migration class file (039_version.php)

Doctrine will apply the migrations sequentially based on the file name, so I have to push out the features in branch A before branch B in order to get Doctrine migration to work.

Should I just keep all migrations in its own branch and change the numbers before going live?

like image 884
Shane Stillwell Avatar asked Apr 18 '11 20:04

Shane Stillwell


1 Answers

Since a branch is there to isolate a development effort, if you ask a task which depends on several branches, said branches are in the way.
It may be better to merge all those branches in a deployment branch, in order to visualize the relevant files for Doctrine to work on.

NDM kindly points out to "Database migrations in a complex branching system" to better illustrate the OP's question:

You could make it work for simple branch patterns, but for anything complicated, it will be a nightmare.

The system I'm working with now takes a different approach: we have no ability to make incremental migrations, but only to rebuild the database from a baseline

NDM adds:

It's just not possible to do sequential migrations correctly in a branched system

like image 199
VonC Avatar answered Oct 14 '22 14:10

VonC