How to manage git branches with different db schemas?

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?

  • Where are all the native revisioned databases?
  • Best git mysql versioning system?
  • Git - how to recover from a missing blob
  • Storing Drupal SQL in Git
  • Keeping development databases in multiple environments in sync
  • Is there a database with git-like qualities?
  • 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.

  • How do I convert an svn repo to git using reposurgeon?
  • Oauth Cloning on github not working (fatal: Authentication failed)
  • GitHub API - find when repo made private
  • Git Revision Expression
  • Restructuring Git repo with prototype code to actual publishable project
  • git commit can't find (global) config running in cron job
  • One Solution collect form web for “How to manage git branches with different db schemas?”

    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).

    Git Baby is a git and github fan, let's start git clone.