I have the following situation. Lets say a project is operated via git feature branches each created from master. So dev1 creates a migration script on branch1 and runs it. The changes are in DB. dev1 moves to branch2 (which is created from master). Since branch1 is not yet merged on master, branch2 has the DB changes from branch1 but not the code that reflects this since branch1 is not yet merged to master. Has anybody dealt with something like automated rollback of branch1 db changes? Any ideas/brainstorming welcome!
You mean separate DB per branch? … sounds like a lot of work. I was thinking something with githooks to trigger Yii rollback but cannot think of exact solution
I haven’t settled on a particular workflow with Yii2 yet - but I manage my database purely through migrations, so that - when I switch to a new branch I switch by cloning (new directory) and then generate a new database by running my migrations again, after I’ve run bower and composer install.
So a completely new environment.
I only need to change the name of the database in the local config scripts, and I guess I could automate that, but I don’t.
So nothing fancy.
It also helps ensure that I can reproduce the project at any time.