Skip to content
schambers edited this page Sep 14, 2010 · 27 revisions

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:

Create Expression

Allows you to create a table, column, index, foreign key and schema.

Create.Table("Users")
    .WithIdColumn()
    .WithColumn("Name").AsString().NotNullable();

Delete Expression

Allows you to delete a table, column, foreign key and schema.

Delete.Table("Users");

Execute Expression

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");

Insert Expression

Allows you to insert a row into a table using an anonymous type for the rows contents

Rename Expression

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

Clone this wiki locally