0

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

3
  • Are you trying to revert and discard changes or are you trying to upgrade a second database to match an updated database? If you want to update, just generate a sql script as described here: msdn.microsoft.com/en-us/data/jj591621#script Commented Sep 10, 2015 at 13:03
  • Hi Steve, just trying to match the database. Commented Sep 10, 2015 at 18:20
  • Yeah, that's what the -Script is for. Here's another link cpratt.co/… Commented Sep 10, 2015 at 18:23

1 Answer 1

1

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

Update-Database –TargetMigration: db1 

More info.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.