首页 > 解决方案 > 如何重新运行迁移

问题描述

我确实创建了迁移

但是在 Up() 方法中,我调用了一个资源来创建如下视图:

public override void Up()
    {
        Sql(Resources.GetString("sql1").AsSqlString());

        AddColumn("dbo.UserPreference", "ClientGraphCurrencyId", c => c.Int());
        CreateIndex("dbo.UserPreference", "ClientGraphCurrencyId");
        AddForeignKey("dbo.UserPreference", "ClientGraphCurrencyId", "dbo.Currency", "CurrencyId");
    }

之后我对“sql1”资源进行了更改。

问题是如何重新运行迁移,以便对 sql1 的更新应用于 DB

我尝试过更新数据库,但它说:没有未决的显式迁移。

标签: asp.net.netentity-frameworkentity-framework-6

解决方案


推荐阅读