I am setting up a WebApi in .NET Core 2.0. I will be using Entity Framework Core as ORM. Whole app will be deployed as Docker Container. The thing that disturbs me a bit is the way of handling DB migrations in this case. I mean PRODUCTION environment. Here is what I managed to research:
- We just fire Database.Migrate() in the app start forgetting the whole world- hmm somehow I don't like it ;-)
- Database.Migrate() driven by command-line param (run docker container once with a specified param to migrate DB)
- Log into application container and execute
dotnet ef database update
- Generate plain old SQL based on migrations and execute it from DB management tool. Seems oldschool but valid. The thing I hate is to mess with executing scripts on my own.
- Prepare a Database container that would already have scripts generated from code above, and that would automatically execute them.
Any other suggestions ? Or what is the best, most proper solution ?
Regards