Reputation: 1931
What I have:
What I need:
Notes:
I'm running my migrations on my dev station with "dnx ef database update". I guess I can use the webapp PS console but... doesn't seems like the proper way.
I know I can generate a SQL script for the migration but this seems to be too manual.
I remember that the "Publish" wizard had option "Execute EF migrations" in the past. Can't see it now.
Upvotes: 10
Views: 1974
Reputation: 2881
It depends on who has control over the production DB (dev team or separate DBA team).
In a customer project that I worked on, each developer had their own copy of the DB, where they tested all their migrations. Once the application code and migration code got checked in, we used TeamCity as a CI server to deploy the website, update the staging DB, and run unit tests & integration tests.
We provided the SQL scripts (generated by EF) to the DBA team to run against the production DB. Our dev team never touched the production DB.
If you're allowed to update the production DB, you can do it yourself. But I would highly recommend inspecting and then running EF-generated scripts that you can roll back if necessary. Also, don't forget to back up the production DB as needed.
Since you want automation (and if you are comfortable with it), you can use your CI system to update your production DB, the way my team and I updated our staging DB.
Hope that helps!
Upvotes: 2