mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 05:27:00 +03:00
Make schemas work with postgres
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {config} from '../config';
|
||||
import {Sqlite} from './Sqlite';
|
||||
import {Mysql} from './Mysql';
|
||||
import {Postgres} from './Postgres';
|
||||
import {IDatabase} from './IDatabase';
|
||||
|
||||
|
||||
@@ -9,6 +10,26 @@ let privateDB: IDatabase;
|
||||
if (config.mysql) {
|
||||
db = new Mysql(config.mysql);
|
||||
privateDB = new Mysql(config.privateMysql);
|
||||
} else if (config.postgres) {
|
||||
db = new Postgres({
|
||||
dbSchemaFileName: config.dbSchema,
|
||||
dbSchemaFolder: config.schemaFolder,
|
||||
fileNamePrefix: 'sponsorTimes',
|
||||
readOnly: config.readOnly,
|
||||
createDbIfNotExists: config.createDatabaseIfNotExist,
|
||||
enableWalCheckpointNumber: !config.readOnly && config.mode === "production",
|
||||
postgres: config.postgres
|
||||
});
|
||||
|
||||
privateDB = new Sqlite({
|
||||
dbPath: config.privateDB,
|
||||
dbSchemaFileName: config.privateDBSchema,
|
||||
dbSchemaFolder: config.schemaFolder,
|
||||
fileNamePrefix: 'private',
|
||||
readOnly: config.readOnly,
|
||||
createDbIfNotExists: config.createDatabaseIfNotExist,
|
||||
enableWalCheckpointNumber: false
|
||||
});
|
||||
} else {
|
||||
db = new Sqlite({
|
||||
dbPath: config.db,
|
||||
|
||||
Reference in New Issue
Block a user