What's the proper way to run a DotNet ef migrations when deploying with Docker
Dennis Quesada Cruz

Dennis Quesada Cruz @dcruz1990

About: Something like a developer :D

Location:
In a land of... of.... :(
Joined:
Oct 31, 2018

What's the proper way to run a DotNet ef migrations when deploying with Docker

Publish Date: Jan 27 '21
7 2

Hello Devs, im looking for the best aproach to update the app database (DotNet WebApi) when deploying to a Docker Container. This is what i have so far:
1 - Tried to run a migration inside the startup class using context.Database.Migrate(), for some reason didnt work.
2 - Compose build and up, then manually 😅 run bash inside the aspnet container, install ef tool, add the migration and update database.
3 - Get the SQL script runing DotNet ef migrations script and putting it inside a seed. SQL on the Postgres container.

Im wondering if there is a automatic way to do that?

Comments 2 total

Add comment