Add support for PostgresDB and save date as Date

This commit is contained in:
Jan Oberhauser
2019-07-22 20:29:06 +02:00
parent d027545986
commit a9453806b8
27 changed files with 310 additions and 73 deletions

View File

@@ -18,6 +18,7 @@ import * as config from './../config';
import {
MongoDb,
PostgresDb,
SQLite,
} from './databases';
@@ -43,6 +44,16 @@ export async function init(): Promise<IDatabaseCollections> {
url: config.get('database.mongodb.connectionUrl') as string,
useNewUrlParser: true,
};
} else if (dbType === 'postgresdb') {
entities = PostgresDb;
connectionOptions = {
type: 'postgres',
database: config.get('database.postgresdb.database'),
host: config.get('database.postgresdb.host'),
password: config.get('database.postgresdb.password'),
port: config.get('database.postgresdb.port'),
username: config.get('database.postgresdb.user'),
};
} else if (dbType === 'sqlite') {
entities = SQLite;
connectionOptions = {