DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on • Updated on

How you guys handle database versioning?

Working on a large app with tons of developers and branches can quickly lead up to polluting your database with unnecessary columns from the migration that you ran from your co worker's branch or your own feature branch that is not merged in the master yet.

The solution could be to go back to your co worker's branch and rollback the damn migration but we are only human beings.

It would have been nice if the database could change with
git checkout -b <new branch>

and remember the old database with git checkout <old branch>

So, what do you guys use to tackle such issues?

Update 1

For now, I am writing a bash script that will create a database per branch. https://github.com/sushant12/gla

Update 2

So, I just finished writing the script and it is working fine. I will be testing the script with my co-worker on our project at work. Till then you guys can try this at your own risk: https://github.com/sushant12/gla

Top comments (0)