C
C#3y ago
Vinicius

Entity Framework - Migrations Production (Postgres)

I'm using this approach: Create database model -> Create OnModelCreating -> dotnet ef migrations add AND dotnet ef database update But it aint suitable for production. I need to do something on startup.
7 Replies
Vinicius
ViniciusOP3y ago
If someone could suggest me something
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Cisien
Cisien3y ago
EnsureCreated wont update an existing database, instead you will need to call Migrate, which creates if it doesnt exist. Instead of creating your own console app, ef has the ability to generate a migration bundle for you, which you can execute manually or as part of your ci/cd. Ef can also generate sql scripts that you can run
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Cisien
Cisien3y ago
Its new as of 6, iirc
Vinicius
ViniciusOP3y ago
doing like this its impossible versioning it. Do you have an idea of how do it
Want results from more Discord servers?
Add your server