Matthew Flynn
Matthew Flynn

Reputation: 3941

migrating database back to original database entity framework migrations

I have made some changes to a database using code first entity framework migrations (lets say db2).

I now want to revert the change made back to the original database. As we want to retain the data on the old database (db1) I cant simple clone it.

Can someone please confirm the right process to do this?

I am assuming I will need to perform a rollback on db2 back to the original state it was in when it was cloned from db1.

I would then switch context so I am pointing at db1.

I then add a migration to generate all the database changes.

I then perform update-database to run make the changes.

Is this correct?

I will then need to run a migration to br

Upvotes: 0

Views: 25

Answers (1)

Sirwan Afifi
Sirwan Afifi

Reputation: 10824

You can use –TargetMigration parameter in order to migrate to a specific version:

Update-Database –TargetMigration: db1

More info.

Upvotes: 1

Related Questions