1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 04:32:35 +01:00

Rename postgresql to postgres -> fix silently failing migrations

Signed-off-by: TheArcaneBrony <myrainbowdash949@gmail.com>
This commit is contained in:
TheArcaneBrony 2023-01-31 23:33:07 +01:00
parent 6b466ab654
commit 352ad14e9a
3 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ const dbConnectionString =
process.env.DATABASE || path.join(process.cwd(), "database.db"); process.env.DATABASE || path.join(process.cwd(), "database.db");
const DatabaseType = dbConnectionString.includes("://") const DatabaseType = dbConnectionString.includes("://")
? dbConnectionString.split(":")[0]?.replace("+srv", "")?.replace("postgres", "postgresql") ? dbConnectionString.split(":")[0]?.replace("+srv", "")
: "sqlite"; : "sqlite";
const isSqlite = DatabaseType.includes("sqlite"); const isSqlite = DatabaseType.includes("sqlite");
@ -103,7 +103,9 @@ export async function initDatabase(): Promise<DataSource> {
} }
}; };
if (!(await dbExists())) { 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(); await dbConnection.synchronize();
} else { } else {
console.log("[Database] Applying missing migrations, if any."); console.log("[Database] Applying missing migrations, if any.");