【问题标题】:FluentMigrator rollback not workingFluentMigrator 回滚不起作用
【发布时间】:2016-09-12 03:06:07
【问题描述】:

我已经看到了相关的问题。 FluentMigrator Failed Migrations Don't Rollback?Rollback to a specfic Migration in FluentMigrator。但不幸的是,我无法用这个解决方案解决我的回滚问题。我正在使用FluentMigrator 对数据库进行版本控制。

我的迁移代码:

using FluentMigrator;

namespace WebCruiter.Candidate.DBMigration.Migrations.R2016_6
{
    [Migration(20160908000908, "USERSTORY")]
    public class Migration20160908000908 : AutoReversingMigration
    {
        public override void Up()
        {
            Create.Column("TestUrl").OnTable("JobApplication").AsString(500).Nullable();
        }
    }
}

我尝试从命令行回滚这个版本(20160908000908):

migrate.exe -c "server=(LocalDB)\MSSQLLocalDB;Initial Catalog=Candidate;Integrated Security=True" -db sqlserver2014 -a ".\..\..\..\WebCruiter.Candidate.DBMigration\bin\Debug\FluentMigrator.dll" -t rollback:20160908000908

没有来自 JobApplication 的回滚列 TestUrl 它显示:

谁能帮我看看我哪里出错了?

【问题讨论】:

    标签: entity-framework fluent-migrator


    【解决方案1】:

    因为您需要在要回滚到的迁移之前为运行器提供迁移编号。所以假设你有迁移 1、2 和 3。你想回滚 3,你会给跑步者 2

    你现在给跑步者的不是那个,在'20160908000908'之前给它迁移。

    这基本上是Rollback to a specfic Migration in FluentMigrator中写的,你写的是你最后一次迁移的次数,而不是你想回滚到的迁移次数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      相关资源
      最近更新 更多