I have a project that has a db first approach initially. However, I have difficulty managing to deployment it to the customers. Because it needs some db updates and I do this manually.
Is there any solution to turn over my DB first approach to the code first approach?
My project is developed in .net core and c# language and also my database firstly Oracle and also Postgre.
Thanks in advance.
CodePudding user response:
You could probably:
- create ordinary model classes out of the generated model classes
- delete everything else related to the DbFirst approach
- Create a code first migration based on the model classes mentioned above
- Manually insert a row to the
__efmigrationshistory
table (in every database you use) with the name of you migration created above --> that way the first generated migration won't run again, as it shouldn't because your db schema is already created