Multiple identity columns specified for table 'States'. Only one identity column per table is allowed
This post addresses the error that we see when executing Update-Database command inside Package Manager Console. I am going to talk about two continuous error appears and fix is very simple, just read this blog.
Error 1 - Here is the error I got inside Package Manager Console:
Multiple identity columns specified for table 'States'. Only one identity column per table is allowed.
I encountered this error when trying to execute ‘Update-Database’ command and the scaffolded migration script class [which has Up() and Down() methods] failed to arrange drop/add/create/rename job order.
Error 2 - If you again do ordering in a wrong way, you will see another error very similar to one given below.
The object 'PK_dbo.States' is dependent on column 'Key'.
ALTER TABLE DROP COLUMN Key failed because one or more objects access this column.
Now, to make this migration (scaffolded migration script class) work. We have to arrange jobs this way. In the image, green sign is a valid way and red sign is a wrong way.
I don’t know whether it is a template bug or I am doing things in a wrong way, if you know please share.
Hope this helps to one who getting this error.
Thanks for reading.