Database Error after upgrade to 0.165.0

After upgrade docker image to 0.165.0, during startup I got this error:

Initializing n8n process
UserSettings were generated and saved to: /home/node/.n8n/config


INFO: Started migration for execution entity indexes.
      Depending on the number of saved executions, it may take a while.


There was an error initializing DB: "Can't DROP 'IDX_c4d999a5e90784e8caccf5589d'; check that column/key exists"

Stopping n8n...

After investigating, I solved creating this index manually on database:

create index IDX_c4d999a5e90784e8caccf5589d on execution_entity (workflowId);

After this, n8n run migrations as expected.

Very strange. Is it possible that you interrupted a previous migration? Because that would explain why the index was already deleted.

This will be the fix: 🔊 create logger helper for migrations by BHesseldieck · Pull Request #2944 · n8n-io/n8n · GitHub