I have a project where I need to work on a new feature that requires part of the database to be re-designed whilst also keeping the main development branch working on the old schema.
What is your best-practice for managing a project like this?
I thought about having a separate database whilst working on the new feature but realised this would require having the database config checked into the repository which is a no-go. Are there other ways I could approach the issue?
Seed data to the rescue
Right after posting this the answer hit me - I should have some scripts to populate my db with seed data. That way I can just drop/recreate/seed the database when switching between branches.
The usual way to deal with this is to check your database creation scripts into source control. Then you can branch and manage them in the same way as the rest of your source code.
You will need a way of pointing your code at a particular instance of a database (which has been created using the scripts in the current branch).
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