Search Results for

    Show / Hide Table of Contents

    Auto-reversing migrations

    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.

    [Migration(201207080104)]
    public class RenameTableWithSchema : AutoReversingMigration
    {
        public override void Up()
        {
            Rename.Table("TestTable2").InSchema("TestSchema").To("TestTable'3");
        }
    }
    

    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
    • Edit this page
    In this article
    Back to top
    Copyright © 2018 Fluent Migrator Project
    Generated by DocFX
    Creative Commons License
    FluentMigrator Documentation by FluentMigrator Project is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.