Upgrade from 0.205.0 to 0.212.1 → Migration failed

After upgrading from 0.205.0 to 0.212.1, starting n8n from the command line, I get:

2023-01-27T00:44:23.936Z | info     | Initializing n8n process "{ file: 'start.js', function: 'run' }"
2023-01-27T00:44:24.359Z | warn     | Migrations in progress, please do NOT stop the process. "{ file: 'migrationHelpers.js', function: 'logMigrationStart' }"
Migration "DeleteExecutionsWithWorkflows1673268682475" failed, error: Can't create table `n8n`.`execution_entity` (errno: 121 "Duplicate key on write or update")

Any ideas?

Information on your n8n setup

  • n8n version: 0.212.1
  • Database you’re using (default: SQLite): mysql
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

Hey @ColinMacLeod,

Thanks for reporting this one, We are going to look into this today.

@ColinMacLeod are you able to upgrade to 0.210.2 ?
Also, can you please check how many rows does the execution_entity table have?

Sorry, I needed to get it back online so I wiped the database and reimported credentials and workflows.

Hey @ColinMacLeod,

No problem, If you see this again let us know.

1 Like

I’m experiencing the same today. I also need to get back online but I’m happy to report what I can.

0.210.2 to 0.213

Migration "DeleteExecutionsWithWorkflows1673268682475" failed, error: Duplicate foreign key constraint name 'FK_execution_entity_workflowId'

execution_entity has 44,776 records due to webhook activity.

Is the expectation that somehow the volume is what is preventing this migration? I’d like to help here, but I can’t be down terribly long. I’ve grown very spoiled to how infrequently anything goes wrong with an update! :slight_smile:

Thanks,
Greg

Worth noting for records that I’m on Percona Server Cluster - MySQL 8.x

Been using self-hosted a long time (this installation is Dec 2021) without a single issue during migrations.

Reviewing this simple migration it appears to be that part of the migration completed (no transaction?) so it left behind the changes without marking the migration completed.

I removed the FK and let it rerun and we’re good to go!

Thanks,
Greg

2 Likes

Welcome to the community @gregoj! Glad to hear you figured it out already, thanks for sharing :slight_smile:

Sorry, I am facing the same problem.

Would you please help by sharing how to remove the FK?

Thank you!

Hello again, I got it fixed for my instance. And here are the steps:

  1. I dumped the table execution_entity from the n8n database,
  2. I edit the dump and remove the line " CONSTRAINT FK_execution_entity_workflowId FOREIGN KEY (workflowId) REFERENCES workflow_entity (id) ON DELETE CASCADE
    "
  3. I remove the comma before this line, and I saved the edited dump file,
  4. I then restore the dump table execution_entity.

After that, the upgrade became successful.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.