summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-01-31 23:33:07 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-01-31 23:33:07 +0100
commita156c7bc625a7e63426a68ed51762d028ee35aec (patch)
treee56a01ea7868a522af8b6f379e403e5ca00a14bc
parentHotfix postgres connection string to not silently fail migrations (diff)
downloadserver-a156c7bc625a7e63426a68ed51762d028ee35aec.tar.xz
Rename postgresql to postgres -> fix silently failing migrations
Signed-off-by: TheArcaneBrony <myrainbowdash949@gmail.com>
-rw-r--r--src/util/migration/postgres/1673609867556-templateDeleteCascade.ts (renamed from src/util/migration/postgresql/1673609867556-templateDeleteCascade.ts)0
-rw-r--r--src/util/migration/postgres/1675044825710-webauthn.ts (renamed from src/util/migration/postgresql/1675044825710-webauthn.ts)0
-rw-r--r--src/util/util/Database.ts6
3 files changed, 4 insertions, 2 deletions
diff --git a/src/util/migration/postgresql/1673609867556-templateDeleteCascade.ts b/src/util/migration/postgres/1673609867556-templateDeleteCascade.ts
index 41979e59..41979e59 100644
--- a/src/util/migration/postgresql/1673609867556-templateDeleteCascade.ts
+++ b/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
index ac43c928..ac43c928 100644
--- a/src/util/migration/postgresql/1675044825710-webauthn.ts
+++ b/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<DataSource> {
 		}
 	};
 	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.");