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

Broken DeleteExecutionsWithWorkflows migration #5183

Closed
terenaa opened this issue Jan 17, 2023 · 3 comments · Fixed by #5186
Closed

Broken DeleteExecutionsWithWorkflows migration #5183

terenaa opened this issue Jan 17, 2023 · 3 comments · Fixed by #5186

Comments

@terenaa
Copy link
Contributor

terenaa commented Jan 17, 2023

Describe the bug
Migration collects workflow execution IDs instead of workflow IDs preparing to create FK.

const workflowIds: Array<{ id: number }> = await queryRunner.query(`
  SELECT id FROM \`${tablePrefix}execution_entity\`
`);

await queryRunner.query(
  `DELETE FROM \`${tablePrefix}execution_entity\`
  WHERE workflowId IS NOT NULL
  ${workflowIds.length ? `AND workflowId NOT IN (${workflowIds.map(({ id }) => id).join()})` : ''}`,
);

Field id from execution_entity has no relation with workflowId.

To Reproduce
Steps to reproduce the behavior:

  1. Create an entry in execution_entity with workflowId which does not exist in workflow_entity.
  2. ALTER TABLE ... will fail.

Expected behavior
Variable workflowIds should contain ids from workflow_entity table.

Environment:

  • n8n Version 0.211.0
@Joffcom
Copy link
Member

Joffcom commented Jan 18, 2023

Hey @terenaa,

Thanks for reporting this one and a great spot, It looks like @csuermann has popped in a fix already which should make it into the next release.

@Joffcom Joffcom added the Upcoming Release Will be part of the upcoming release label Jan 18, 2023
@janober
Copy link
Member

janober commented Jan 19, 2023

Fix got released with [email protected]

@janober janober removed the Upcoming Release Will be part of the upcoming release label Jan 19, 2023
@ifokeev
Copy link

ifokeev commented Jan 21, 2023

Still not working, version 0.212.0, migration from 0.210.0
Screen Shot 2023-01-21 at 10 51 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants