refactor: prepare code for more than one database
This commit is contained in:
parent
f926cbb398
commit
4c6037f72a
|
@ -10,7 +10,8 @@
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"dev": "electron . --enable-logging",
|
"dev": "electron . --enable-logging",
|
||||||
"rebuild": "electron-rebuild -f -b -t prod,dev,optional",
|
"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",
|
"tsc": "gulp tsc:watch",
|
||||||
"webpack": "webpack --watch",
|
"webpack": "webpack --watch",
|
||||||
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",
|
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import { Connection, createConnection } from 'typeorm';
|
import { Connection, createConnection } from 'typeorm';
|
||||||
|
|
||||||
let connection: Connection;
|
export let library: Connection;
|
||||||
|
|
||||||
function init(): void {
|
function init(): void {
|
||||||
initConnection();
|
initConnection();
|
||||||
|
@ -12,7 +12,7 @@ function initConnection(): void {
|
||||||
// from your ormconfig file or environment variables
|
// from your ormconfig file or environment variables
|
||||||
createConnection('library')
|
createConnection('library')
|
||||||
.then((c: Connection) => {
|
.then((c: Connection) => {
|
||||||
connection = c;
|
library = c;
|
||||||
})
|
})
|
||||||
.catch((reason: any) => {
|
.catch((reason: any) => {
|
||||||
throw reason;
|
throw reason;
|
||||||
|
|
Loading…
Reference in New Issue