What’s the Error?
If you're seeing an error like:
Error running database migrations: MigrationError: Migration 20240917205035-add-secrets-rotation-run-uuid-column-to-multiple-tables.js (up) failed: Original error: canceling statement due to statement timeout
This means that during a database migration, Retool attempted to add a column that already exists in your database.
Why This Happens
This usually occurs when:
- You're switching between Retool Stable and Edge versions.
- A database migration has partially run during a prior upgrade.
- You're doing a non-linear upgrade path (e.g. jumping from a lower Stable version to a higher Edge version or vice versa).
Example Scenario
Let’s say you're on version 3.114.0-stable and upgrade to 3.116.0-edge. This Edge version may only include one out of the five full database migrations that are included in the next Stable release (3.196.0).
When you later upgrade to 3.196.0-stable, Retool will attempt to run all five migrations. But since one already ran while you were on the Edge version, you might hit this error because the column was already created.
How to Fix It
- Check Your Database SchemaFirst, verify that the column mentioned in the error already exists.Example error:
column "secretsRotationRunUuid" of relation "api_keys" already exists
→ Go to your database and confirm:
- Does the
api_keystable exist? - Does it already contain a
secretsRotationRunUuidcolumn? If yes, that part of the migration has already been applied.
- Mark the Migration as Completed
If the necessary schema changes already exist, you can safely mark the migration as completed so Retool doesn’t try to run it again.To do this, insert the migration name into theSequelizeMetatable:
INSERT INTO "SequelizeMeta"
VALUES ('20240917205035-add-secrets-rotation-run-uuid-column-to-multiple-tables.js');
Note: Some migrations may add multiple columns and indexes—sometimes 10 or more—so be sure to verify all expected changes by reviewing your errors or contact us on Support before inserting this row marking the migration as complete.