From 352ad14e9af1b0a5ef065fac547a24fba32b6f32 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Tue, 31 Jan 2023 23:33:07 +0100 Subject: [PATCH] Rename postgresql to postgres -> fix silently failing migrations Signed-off-by: TheArcaneBrony --- .../1673609867556-templateDeleteCascade.ts | 0 .../{postgresql => postgres}/1675044825710-webauthn.ts | 0 src/util/util/Database.ts | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) rename src/util/migration/{postgresql => postgres}/1673609867556-templateDeleteCascade.ts (100%) rename src/util/migration/{postgresql => postgres}/1675044825710-webauthn.ts (100%) diff --git a/src/util/migration/postgresql/1673609867556-templateDeleteCascade.ts b/src/util/migration/postgres/1673609867556-templateDeleteCascade.ts similarity index 100% rename from src/util/migration/postgresql/1673609867556-templateDeleteCascade.ts rename to src/util/migration/postgres/1673609867556-templateDeleteCascade.ts diff --git a/src/util/migration/postgresql/1675044825710-webauthn.ts b/src/util/migration/postgres/1675044825710-webauthn.ts similarity index 100% rename from src/util/migration/postgresql/1675044825710-webauthn.ts rename to src/util/migration/postgres/1675044825710-webauthn.ts diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts index 31dfa710..492fb4e4 100644 --- a/src/util/util/Database.ts +++ b/src/util/util/Database.ts @@ -36,7 +36,7 @@ const dbConnectionString = process.env.DATABASE || path.join(process.cwd(), "database.db"); const DatabaseType = dbConnectionString.includes("://") - ? dbConnectionString.split(":")[0]?.replace("+srv", "")?.replace("postgres", "postgresql") + ? dbConnectionString.split(":")[0]?.replace("+srv", "") : "sqlite"; const isSqlite = DatabaseType.includes("sqlite"); @@ -103,7 +103,9 @@ export async function initDatabase(): Promise { } }; if (!(await dbExists())) { - console.log("[Database] This appears to be a fresh database. Synchronising."); + console.log( + "[Database] This appears to be a fresh database. Synchronising.", + ); await dbConnection.synchronize(); } else { console.log("[Database] Applying missing migrations, if any.");