Skip to content
tabushi edited this page Sep 29, 2011 · 7 revisions

Profiles are used to selectively apply migrations depending on a command line option, or build script attribute. For instance, you may want to run the “Development” profile only in your Dev environment, and run the “Production” profile in your Production environment. Profiles will always be run if you specify them.

Normally, these are useful to always put test/sample seed data in when dropping/refreshing development and testing environments. In production you would rarely want to continually insert the same data more than once.

[Profile("Development")]
public class CreateDevSeedData : Migration
{
    public override void Up()
    {
        Insert.IntoTable( "User" ).Row( new
            {
                Username = "devuser1",
                DisplayName = "Dev User"
            });
    }

    public override void Down()
    {
        //empty, not using
    }
}

Now that you have migrations and profiles defined, you can use Migration Runners to apply changes to your database.

Clone this wiki locally