Reputation: 29227
I'm using Entity framework code first and I have almost 10 migrations now. I found a design issue and some of the DBMigrations are not what I expected and I want to re-generated the database.
Migrations
folder and delete the database? What if I want to keep the first xxxxxx_InitialCreate.cs and restart from there?)Upvotes: 0
Views: 137
Reputation: 1344
You could revert to that initial migration
Update-Database [-SourceMigration <String>] [-TargetMigration <String>]
[-Script] [-Force] [-ProjectName <String>] [-StartUpProjectName <String>]
[-ConfigurationTypeName <String>] -ConnectionString <String>
-ConnectionProviderName <String> [<CommonParameters>]
is the Syntax so:
Update-Database -TargetMigration InitialCreate
reverts your database to the initial migrationFor the second part I would just change the connection string to the production database and run the migration again. No loss of data should occur.
Upvotes: 1