forked from fluentmigrator/fluentmigrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Profiles
TheCloudlessSky edited this page Feb 13, 2012
·
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 “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.
- Getting FluentMigrator
- How to create a Migration
- Fluent Interface
- Migration Runners
- Use inbuilt database functions when setting the default value
- Sql Server Specific Extensions
- Raw Sql Helper for inserting data
- Auto Reversing Migrations
- Resharper File Template
- Transaction Modes for the Migration Runner
- ApplicationContext: Passing parameters to Migrations
- Dealing with Multiple Database Types
- Filter migrations run based on Tags
- Enforce migration version numbering rules
- Create custom metadata for the VersionInfo table