mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
removed some logic from index
This commit is contained in:
parent
66324fe1ca
commit
e092af22e3
@ -26,10 +26,7 @@ const DB_VERSION = '0001-init_db'
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
// open mysql connection
|
// open mysql connection
|
||||||
let con = null
|
const con = await connection()
|
||||||
try {
|
|
||||||
con = await connection()
|
|
||||||
} catch (error) {}
|
|
||||||
if (!con || !con.isConnected) {
|
if (!con || !con.isConnected) {
|
||||||
throw new Error(`Couldn't open connection to database`)
|
throw new Error(`Couldn't open connection to database`)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,10 @@ import { createConnection, Connection } from 'typeorm'
|
|||||||
import CONFIG from '../config'
|
import CONFIG from '../config'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
const connection = async (): Promise<Connection> => {
|
const connection = async (): Promise<Connection | null> => {
|
||||||
const con = await createConnection({
|
let con = null
|
||||||
|
try {
|
||||||
|
con = await createConnection({
|
||||||
name: 'default',
|
name: 'default',
|
||||||
type: 'mysql',
|
type: 'mysql',
|
||||||
host: CONFIG.DB_HOST,
|
host: CONFIG.DB_HOST,
|
||||||
@ -14,6 +16,7 @@ const connection = async (): Promise<Connection> => {
|
|||||||
entities: [path.join(__dirname, 'entity', '*.ts')],
|
entities: [path.join(__dirname, 'entity', '*.ts')],
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
})
|
})
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
return con
|
return con
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user