So I have a basic problem trying to generate a migration when I don't have a DB in sync (up to the latest migration, in fact, have no DB at all) and have already made substantial changes to my model.
This are the specific details:
I realize that after the failure in #5 I can now run #4. Then re-try #5 and voilá.
My Question is if this is the expected approach to solve this silly situation.
I would use the following approach.
First you need to apply migrations and specify the last one.
PM> Update-Database -TargetMigration AnyMigrationName
# It updates database to a migration named "AnyMigrationName"
# This will apply migrations if the target hasn't been applied or roll back migrations
# if it has
When your local database is updated you simply add new migration.
PM> Add-Migration NewMigrationName
# it scaffolds a new migration named "NewMigrationName"
Looking for a good reference I found these blog posts about EF Migrations that can help you a lot. They cover many questions and EF Migrations and a Merge Conflict and EF Migrations Command Reference in particular.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With