Stop running migrations by default #4438
-
I am using Elsa v3 and I have created a separate project to deal with the schema migrations. The plan is to run the migrations only when I upgrade the Elsa packages. The problem I am having is that, though I have created fresh migration and applied on the database after package upgrade, the project complains about some table already exists during startup. How can I deal with this? I can't afford deleting the DB each time I do upgrade Elsa packages. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello @abhjitsantra I completely understand, and maintaining your own migrations is the recommended approach, because this gives you full control over when and how you update your schemas. So, you are right to want to opt-out of automatically running migrations. To do so, set the For example: services.AddElsa(elsa =>
{
elsa.UseIdentity(identity => identity.UseEntityFrameworkCore(ef => ef.RunMigrations = false));
elsa.UseManagement(management => management.UseEntityFrameworkCore(ef => ef.RunMigrations = false));
elsa.UseRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.RunMigrations = false));
}) I hope this helps! |
Beta Was this translation helpful? Give feedback.
Hello @abhjitsantra
I completely understand, and maintaining your own migrations is the recommended approach, because this gives you full control over when and how you update your schemas.
So, you are right to want to opt-out of automatically running migrations. To do so, set the
RunMigrations
flag tofalse
when configuring a feature with EF Core.For example:
I hope…