2015-11-25 158 views
0

我和我的同事正在研究同一個項目,這是一個使用EF 6 Code First aproach的小型liburary。爲了使數據庫保持最新,我們正在使用遷移。昨天我合併了我的同事的分支。該分支包含由Add-Migration [MigrationName]命令創建的兩個新遷移。 現在,當我嘗試運行Update-Database命令我得到一個錯誤EF沒有看到來自合併的手動創建的遷移

Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration. 

我試圖重新運行Add-Migration命令,看看有什麼模型的「新」。 EF爲我的同事遷移中所做的所有更改創造了一次巨大的遷移。它看起來像EF沒有看到,從合併進來

+0

你需要讓你的同事的migrationnames並做'添加遷移[MigrationName1]'然後遷移第二個只更新元數據我相信 –

+0

感謝您的建議。我試過這種方法。例如,我從我的同事那裏獲得了** AddContractTables **遷移,並且像您所建議的那樣運行「Add-Migration AddContractTables」。 EF已經創建了名爲** AddContractTables1 **的新遷移 – Anton

回答