Execute FluentMigrator migrations from code

Paya picture Paya · May 1, 2010 · Viewed 25.5k times · Source

Are there any tutorials or example code for executing FluentMigrator migrations from within code? Some "Getting Started..." tutorial would be just awesome. All I was able to find was FluentMigrator.Tests (unit tests), inside FluentMigrator source, which are not as helpful as "Getting Started..." would be.

I just want to add few classes to the project and run the migrations from that project, with no external tools. Is it possible in Fluent Migrator? Something like

FluentMigrator.Migrate("database path", typeof(Migration024));

which I would call from Program.Main()?

Answer

Christian Specht picture Christian Specht · Apr 4, 2011

One of the original authors of FluentMigrator just wrote this "Getting started" blogpost.