refactor: prepare code for more than one database
This commit is contained in:
parent
f926cbb398
commit
4c6037f72a
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue