From 0e4827ce3644294c709a599340ede5f29e19fcad Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Tue, 12 Jan 2021 15:25:55 +0100 Subject: [PATCH] Fixing error with new installations --- packages/cli/src/Db.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/Db.ts b/packages/cli/src/Db.ts index 2cdead7651..6a19abf250 100644 --- a/packages/cli/src/Db.ts +++ b/packages/cli/src/Db.ts @@ -186,7 +186,13 @@ export async function init(): Promise { // This specific migration changes database metadata. // A field is now nullable. We need to reconnect so that // n8n knows it has changed. Happens only on sqlite. - const migrations = await connection.query(`SELECT id FROM ${entityPrefix}migrations where name = "MakeStoppedAtNullable1607431743769"`); + let migrations = []; + try { + migrations = await connection.query(`SELECT id FROM ${entityPrefix}migrations where name = "MakeStoppedAtNullable1607431743769"`); + } catch(error) { + // Migration table does not exist yet - it will be created after migrations run for the first time. + } + // If you remove this call, remember to turn back on the // setting to run migrations automatically above.