0

I am using EF6 with existing db and a separate new schema for my code first. We were moving from staging to Production, and suddenly realized that all db's code first objects were gone, all beside the migration table. Of course everybody blamed code first as the cause. Is it possible? or maybe someone deleted the objects manually by mistake? In my Static Context constructor I used

Database.SetInitializer(new MigrateDatabaseToLatestVersion 
oshi oshi
  • 69
  • 7
  • How did you deploy? Did you start with an empty database and do migrations or generate a script? You running migrations via the console or in code? Is this EF Core or EF 6? What is your database initializer? Code first is not the problem. – Steve Greene Nov 19 '17 at 16:57
  • @Steve Greene: Thank you!!! I added this info in my question. – oshi oshi Nov 20 '17 at 09:35
  • Were you starting with a blank database or trying to upgrade an existing one? In PROD, we usually set our initializer to NULL and use scripts to update (a DBA requirement for us). – Steve Greene Nov 20 '17 at 14:43
  • @SteveGreene: existing db and a separate new schema for the code first – oshi oshi Nov 21 '17 at 10:39

0 Answers0