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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With