-
Notifications
You must be signed in to change notification settings - Fork 1
Fluent Interface
The FM fluent api allows you to create tables, columns, indexes and (nearly) every construct you need to manipulate your database structure.
Behind the scenes, the fluent api populates a semantic model that FM uses to analyze and apply migrations in batch. The fluent api that is available in your Migration class starts with five main root expressions as follows:
Allows you to create a table, column, index, foreign key and schema.
Create.Table("Users")
.WithIdColumn()
.WithColumn("Name").AsString().NotNullable();
Allows you to delete a table, column, foreign key and schema.
Delete.Table("Users");
Allows you to execute a block of sql, or a script by name (ie. myscript.sql)
Execute.Script("myscript.sql");
Execute.Sql("DELETE TABLE Users");
Allows you to insert a row into a table using an anonymous type for the rows contents
Allows you to rename a column or table.
Profiles are migrations that if specified, will always run regardless of what other migrations run.
Migration Runners explains how to run your migrations 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