Revert to previous version in Fluent Migrator

I am trying to get migrations to work with my project using a free migrator. But due to lack of documentation, I'm trying to figure out how to roll back and call a method Downfor my migration class.

I installed the database with the initial class of version 1:

[Migration(1)]
public class Baseline : Migration
{
    public override void Up()
    {
        Execute.Script("1_Baseline\\baseline.sql");
    }

    public override void Down() { }
}

I am migrating through a batch file containing the following:

".... \ tools \ fluentmigrator \ migrate.exe" --connection "Data Source =. \ sqlexpress; Initial Catalog = ekmDomains; Integrated Security = true; multipleactiveresultsets = true;" --db SqlServer2005 --target "bin \ Release \ EkmDomains.Migrations.dll"

This works great. So I wrote a second migration class to test it:

[Migration(2)]
public class AddNewTable : Migration
{
    public override void Up()
    {
        Create.Table("NewTable").WithColumn("name").AsString();
    }

    public override void Down()
    {
        Delete.Table("NewTable");
    }
}

. --version. , --version 1, Down AddNewTable. , , . ' ', . , .

- - , ?

+7
1

-t migrate:down. "-", migrate.exe , rollback:toversion rollback:all.

+16

All Articles