Migr8 is a short’n’sweet SQL Server schema migration library with a silly name that makes it easy to evolve your database schema. It’s pretty simple, but it’s still kind of sophisticated….

Let’s pretend you have a connection string in your app.config named db – evolve that database by going

when your application starts up, and start writing your migrations like this:

By default, Migr8 will keep track of the version of your database in a table called __Migr8 – it logs the full migration SQL along with information on when the migration was run, and by whom.

So why is it sophisticated?

Because it enables a git workflow with parallel development of feature branches by allowing for qualifying the ID of each migration with a branch specification. Say for example that you and your best friend are working on two branches, feature-A and feature-B – if you stay away from each other’s stuff in the database, you can both add migration 2 like this:

and it will not matter which migration is executed before the other. Migr8 will happily remember to run them both when the branches are integrated with master.

Binary is on NuGet.org.

Source code is on GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *