Reputation: 1421
I created a web api application in .net core 2.0
and I create my database using code first approach and using the commands add-migration
, update-database
Now I made some changes in my model classes and created a new migration using add-migration 2ndMigration
command. It created the migration with Up
and Down
methods. When I try to update database with this migration it gives me an error that
Table 'TableName' already exists.
There's no create table command in the migration.
Why I'm seeing this error? or what's the command I need to run to update the database?
Upvotes: 0
Views: 944
Reputation: 6502
run Add-Migration Initial -IgnoreChanges -ConfigurationTypeName YourDbConfigurationName
and add -force
if needed.
After that use your regular Update-database
line.
Upvotes: 1