refactor: prepare code for more than one database

This commit is contained in:
Xymorot 2019-07-05 22:51:05 +02:00
parent f926cbb398
commit 4c6037f72a
2 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,8 @@
"start": "electron .",
"dev": "electron . --enable-logging",
"rebuild": "electron-rebuild -f -b -t prod,dev,optional",
"typeorm:migrate": "typeorm migration:run -c library",
"typeorm:migrate": "npm run typeorm:migrate:library",
"typeorm:migrate:library": "typeorm migration:run -c library",
"tsc": "gulp tsc:watch",
"webpack": "webpack --watch",
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",

View File

@ -1,7 +1,7 @@
import 'reflect-metadata';
import { Connection, createConnection } from 'typeorm';
let connection: Connection;
export let library: Connection;
function init(): void {
initConnection();
@ -12,7 +12,7 @@ function initConnection(): void {
// from your ormconfig file or environment variables
createConnection('library')
.then((c: Connection) => {
connection = c;
library = c;
})
.catch((reason: any) => {
throw reason;