Auto Reversing Migrations

kalenwatermeyer edited this page Mar 2, 2016 · 3 revisions
Clone this wiki locally

Auto reversing migrations are migrations that only contain an up command and FluentMigrator figures out the down command. Create a migration class that inherits from AutoReversingMigration (instead of Migration) to use this feature.

public class RenameTableWithSchema : AutoReversingMigration
    public override void Up()

FluentMigrator can automatically figure out the down command and revert the rename. However, not all expressions are supported for auto reversing. For example, using the Execute expression to execute an sql script is impossible to reverse. Expressions that are currently supported for auto reversing are:

  • Create.Table
  • Create.Column
  • Create.Index
  • Create.ForeignKey
  • Create.Schema
  • Delete.ForeignKey
  • Rename.Table
  • Rename.Column