From 1259c326d6a10edd5168ee5a97d6a7bb7c08bce9 Mon Sep 17 00:00:00 2001 From: Joakim Uddholm Date: Tue, 26 Nov 2024 11:55:50 +0100 Subject: [PATCH] fix: database creation for plugins should happen with the default pg pool --- core/src/data/Migration.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/data/Migration.ts b/core/src/data/Migration.ts index a5da91bd..d965eeab 100644 --- a/core/src/data/Migration.ts +++ b/core/src/data/Migration.ts @@ -28,6 +28,9 @@ export class Migration { async migrate(dal: DataAccessLayer) { const host = await config.postgres.host.getValue(); const databaseName = await getDatabaseName(this.pluginSuffix); + + await this.ensureDbExists(dal.pool._pool, databaseName); + const pool = this.pluginSuffix ? await dal.pluginPool(this.pluginSuffix) : dal.pool._pool; @@ -36,8 +39,6 @@ export class Migration { `Starting migration for ${process.env.NODE_ENV} (${host} - ${databaseName})` ); - await this.ensureDbExists(pool, databaseName); - const migrationConfig: MigrateDBConfig = { client: pool }; const migs = await postgresMigrate(migrationConfig, this.folderPath);