1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +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 f7c0317c8d
commit a156c7bc62
No known key found for this signature in database
GPG Key ID: 32FC5AAADAD75A22
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");
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.");