Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALTER TABLE DROP COLUMN failed because column 'xxx' does not exist in table 'yyy'

I make a mistake. I delete some row in table __MigrationHistory in my database.
and now when I run my project I force this error:

ALTER TABLE DROP COLUMN failed because column 'xxx' does not exist in table 'yyy'.

How can I solved this problem?

like image 591
Majid Basirati Avatar asked Apr 14 '16 15:04

Majid Basirati


2 Answers

Add a new migration to re-synchronize:

add-migration MissingXXX -IgnoreChanges // tells EF to just take a snapshot
update-database

Now you are back in sync and can continue with future model changes.

like image 140
Steve Greene Avatar answered Sep 27 '22 22:09

Steve Greene


OK, finally I solved my problem.
I added field 'xxx' to table 'yyy' manually in my database.

like image 41
Majid Basirati Avatar answered Sep 28 '22 00:09

Majid Basirati