entity framework - Updating database table & column -


using mvc4 , ef code first

i renamed table/column-name i.e. table: categories category in model , in code , when run migration statement

update-database -verbose -force 

i error:

the create unique index statement terminated because duplicate key found object name 'dbo.categories' , index name 'pk_dbo.categories'. duplicate key value (). not create constraint. see previous errors. statement has been terminated.

in configuration file have automaticmigrationsenabled = true;

is there else need make changes apply in database?

you cannot modify pk.

1 - delete existing database run update-database

2 - generate update script running update-database -script , add drop index tsql generated file , run script.

3 - remove key constrain table via visual studio or management studio remove tsql dropping index in generated script run script.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -