Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Elsa 3.3 is incompatible with existing 3.1 and 3.2 databases #6103

Closed
Suchiman opened this issue Nov 7, 2024 · 1 comment · Fixed by #6105
Closed

[BUG] Elsa 3.3 is incompatible with existing 3.1 and 3.2 databases #6103

Suchiman opened this issue Nov 7, 2024 · 1 comment · Fixed by #6105
Labels
bug Something isn't working

Comments

@Suchiman
Copy link
Contributor

Suchiman commented Nov 7, 2024

Description

If you're upgrading an Elsa v3.1 or v3.2 project to v3.3, you'll run into an error, saying that "WorkflowDefintions table already exists".

Steps to Reproduce

  1. Create a project with Elsa 3.2 using EFC + SqlServer for example.
  2. Run it once to have the Schema created
  3. Upgrade Elsa nugets to 3.3
  4. Run it again
  5. WorkflowDefintions table already exists error will show up

Expected Behavior

Just works and silently upgrades the db schema to 3.3

Actual Behavior

Crashes

Root cause

In #6059 you removed all existing migrations and created a new V3_3 migration. The way how migrations in EFC works, is that it enumerates all migrations in the assembly, then consults the __EFMigrationsHistory table and executes all migrations not listed in that table. Since V3_3 is not listed, it will be executed, but since you've removed all migrations, V3_3 does contain the entire schema and not just the delta from V3_2, meaning it will attempt to create tables that already exist and fail. The proper procedure to reset all migrations in a safe way is listed here https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/managing?tabs=dotnet-core-cli#resetting-all-migrations

@Suchiman Suchiman added the bug Something isn't working label Nov 7, 2024
Suchiman added a commit to Suchiman/elsa-core that referenced this issue Nov 7, 2024
@sfmskywalker
Copy link
Member

I see. I should not have deleted the V3_0, V3_1 and V3_2 migrations, only the V3_3 (which will break only those who are on the 3.3 preview/rc).

sfmskywalker added a commit that referenced this issue Nov 8, 2024
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants