Should we always migrate the DB? #1256
-
After looking through the template for the first time, it looks like the DB only runs migrations during development builds. Is there a reason this is the case? To me, it seems like the app should always initialize the DB when starting regardless of environment, but I am new to some of these topics so looking for clarification. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The strategy mentioned initialises the database on application startup while preserving existing data. This is a productive and simple strategy for local development environments. However, it is not appropriate for other environments, such as staging and production. For these environments, database initialisation should occur during deployment. https://jasontaylor.dev/ef-core-database-initialisation-strategies/ |
Beta Was this translation helpful? Give feedback.
The strategy mentioned initialises the database on application startup while preserving existing data. This is a productive and simple strategy for local development environments. However, it is not appropriate for other environments, such as staging and production. For these environments, database initialisation should occur during deployment.
https://jasontaylor.dev/ef-core-database-initialisation-strategies/
https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#apply-migrations-at-runtime