1

I have a solution with an MVC 4 project and a class library. Both the MVC 4 project and the class library have database migrations enabled on them. I can run "Update-Database" for each project and apply both migrations to the database but when I try to add an addition migration to either project, the migration includes code to remove the tables from the other project's migrations. Any help on this would be appreciated.

Note: This is not a duplicate. This question is about migrations. My problem is that each set of migrations takes over the entire database.

2
  • Checkout stackoverflow.com/questions/12066249/… Commented Mar 19, 2013 at 23:10
  • @Geoff, thanks for the link but not exactly what I'm looking for. Basically, my problem is that each set of migrations takes over the entire database. Any thoughts? Commented Mar 21, 2013 at 21:47

1 Answer 1

0

Code first right?

i'm not sure if this will answer your question but you can try either of the following

  • CreateDatabaseIfNotExists - this will only recreate the database if it does not exists
  • DropCreateDatabaseAlways - this will always recreate the database, this will delete the current database including the data then recreate the database schema
  • DropCreateDatabaseIfModelChanges - this will recreate the database if you change your model classes and will loose all the data.

hope that helps

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.