From 1e885590cb3f42005df002e66989c63e90b81ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Mon, 12 Feb 2024 10:44:42 +0100 Subject: [PATCH] fix: initial start of the app fails due to missing migrations in the main db --- src/services/databaseManagement.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/databaseManagement.ts b/src/services/databaseManagement.ts index 2ad2dbe..598ac62 100644 --- a/src/services/databaseManagement.ts +++ b/src/services/databaseManagement.ts @@ -30,11 +30,12 @@ const migrateToLatest = async (client: Knex): Promise => { }; export const migrateAll = async (): Promise => { + await migrateToLatest(mainClient); const databaseSchemas = await getAllDatabaseSchemaConnections(); - await Promise.all( - databaseSchemas.map(async (sc) => await migrateToLatest(sc)), - ); + await Promise.all([ + ...databaseSchemas.map(async (sc) => await migrateToLatest(sc)), + ]); // 1. get all regions from main DB // 2. construct region specific knex clients and cache them by // 3. structure the cache so that it accomodates client creation by resource id