Skip to content

Profiles

TheCloudlessSky edited this page · 7 revisions
Clone this wiki locally

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 “Testing” profile in your Testing 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.

Something went wrong with that request. Please try again.