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]I copied Elsa The Entity Framework Core. MySQL project and updating the MySqlDesignTimeVNet Factory class to use MySQL version 9.0.1, as well as generating migration files, cannot solve the error problem of MySQL does not yet support 'Limit&IN/ALL/ANY/OME subquery'. It is necessary to modify the Elsa source code embedding issue to solve this problem. #6126

Open
EthanZqh opened this issue Nov 18, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@EthanZqh
Copy link

It may be necessary to change the source code nesting to solve the problem,
The code is as follows:
DELETE w
FROM WorkflowInboxMessages AS w
WHERE w.Id IN (
SELECT w0.Id
FROM (select w1.Id from WorkflowInboxMessages AS w1
WHERE w1.ExpiresAt <= @__now_0
LIMIT 3 OFFSET 2) AS w0
)
I am unable to modify the source code. I hope the teacher can modify the source code to solve this problem. Thank you!

elsa1
elsa2
elsa3
Elsa4
I have tried many times to modify the MySQL version, but it still doesn't work. I have been confused for a long time, but I still can't solve this error problem. I hope the teacher can modify the nested source code to solve this problem. Thank you!

@EthanZqh EthanZqh added the bug Something isn't working label Nov 18, 2024
@sfmskywalker
Copy link
Member

@EthanZqh I’ve noticed several duplicate issues being created, and I kindly ask again to consolidate your input into a single issue. This helps keep the project organized and ensures we can address your concerns effectively. Please take this opportunity to combine all relevant points into one issue. If duplicate issues continue to be submitted, I may need to take further action, including restricting access, to maintain the project’s workflow. Thank you for your understanding.

@EthanZqh
Copy link
Author

@EthanZqh I’ve noticed several duplicate issues being created, and I kindly ask again to consolidate your input into a single issue. This helps keep the project organized and ensures we can address your concerns effectively. Please take this opportunity to combine all relevant points into one issue. If duplicate issues continue to be submitted, I may need to take further action, including restricting access, to maintain the project’s workflow. Thank you for your understanding.

@sfmskywalker Teacher, I have consolidated the repeated questions into one, and I have tried many times without success. I sincerely hope that the teachers can solve this problem. Thank you!

@sfmskywalker
Copy link
Member

Thank you, I appreciate it.

Given that I can't reproduce any issues when using the latest MySql server version using the existing MySql EF Core migrations of Elsa, here's my recommendation:

  1. Copy the Elsa.EntityFrameworkCore.MySql project into your own solution and rename it to e.g. Elsa.EntityFrameworkCore.MySqlVersion8, or pick a name that makes most sense to you.
  2. Delete the Migrations folder that came with.
  3. Update the MySqlDesignTimeDbContextFactory class to use the desired version of MySql instead of "9.0.0".
  4. Replace the Elsa.EntityFrameworkCore.csproj project reference with a package reference to Elsa.EntityFrameworkCore
  5. Update the namespaces to match your class library name.
  6. Build the class library to make sure everything compiles OK.
  7. Install the ef-migration-runtime-schema tool.
  8. Run the dotnet CLI to generate migrations for each core module (Alterations, Identity, Labels, Management and Runtime)
  9. Update your program's project to refernece your custom migrations class library and remove the Elsa.EntityFrameworkCore.MySql package reference.

Here's the CLI command to install the migration tool:

dotnet tool install --global ef-migration-runtime-schema --version 1.0.2

And here are the CLI commands to generate migrations. Make sure to execute it within the directory of your custom class library:

ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c AlterationsElsaDbContext

ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c IdentityElsaDbContext

ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c LabelsElsaDbContext

ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c ManagementElsaDbContext

ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c RuntimeElsaDbContext

With that, you should now have your own MySql migrations that generates compatible code for your version of MySql.

@EthanZqh
Copy link
Author

@sfmskywalker Teacher, I used MySQL version 8.0.30 and followed your steps to implement it, but in the end, the problem remained the same and ended in failure. Is it Elsa.UseWorkflowManagement and elsa.UseWorkflowRuntime What are the issues caused by passing parameters to the two calling methods ?
error1

error2
error3

@EthanZqh
Copy link
Author

@sfmskywalker Teacher, have you used these two methods below?
elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseMySql(builder.Configuration.GetConnectionString("Default"))));

elsa.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.UseMySql(builder.Configuration.GetConnectionString("Default"))));

@EthanZqh
Copy link
Author

@sfmskywalker Teacher, in the CLI window, I am unable to execute the "ef migration runtime schema -- interface Elsa. Entity Framework Core. ElsaDBContextSchema -- efOptions" command "migrations add V3_3- c AlterationsElsaDBContext". Instead, I successfully executed the command "VNet ef migrations add V3_3- c AlterationsElsaDBContext" and generated the migration file, but it still cannot solve this problem. Is it because this command is different from yours that compatible MySQL code was not generated?
migration1
migration2
migration3

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

No branches or pull requests

2 participants