2014-03-13 57 views
0

我被困在命令後不工作:要通過這個tutorial by Tom Dysktra更新數據庫命令初始遷移

這裏

update-database 

雖然是我得到的錯誤:

PM> update-database 
Specify the '-Verbose' flag to view the SQL statements being applied to the target database. 
No pending explicit migrations. 
Running Seed method. 
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid column name 'EmailAddress'. 
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 

...

at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) 
An error occurred while executing the command definition. See the inner exception for details. 

回答

0

您是否嘗試過詳細命令?我通常在控制檯上執行以下操作:

update-database -force -verbose 

它還表示沒有未完成的遷移。我將在黑暗中拍攝並猜測您已關閉自動遷移功能。這意味着之前您可以更新的數據庫,你需要創建一個遷移

add-migration NameItSomethingMeaningful 

現在,您可以更新數據庫

相關問題