mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
errors on failed connection to help debugging, entities from database project in typeorm connection
This commit is contained in:
parent
634733cd59
commit
aa07ef2231
@ -1,6 +1,6 @@
|
|||||||
import { createConnection, Connection } from 'typeorm'
|
import { createConnection, Connection } from 'typeorm'
|
||||||
import CONFIG from '../config'
|
import CONFIG from '../config'
|
||||||
import path from 'path'
|
import { entities } from '@entity/index'
|
||||||
|
|
||||||
const connection = async (): Promise<Connection | null> => {
|
const connection = async (): Promise<Connection | null> => {
|
||||||
let con = null
|
let con = null
|
||||||
@ -13,10 +13,13 @@ const connection = async (): Promise<Connection | null> => {
|
|||||||
username: CONFIG.DB_USER,
|
username: CONFIG.DB_USER,
|
||||||
password: CONFIG.DB_PASSWORD,
|
password: CONFIG.DB_PASSWORD,
|
||||||
database: CONFIG.DB_DATABASE,
|
database: CONFIG.DB_DATABASE,
|
||||||
entities: [path.join(__dirname, 'entity', '*.{ts,js}')],
|
entities,
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
})
|
})
|
||||||
} catch (error) {}
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
|
||||||
return con
|
return con
|
||||||
}
|
}
|
||||||
|
|||||||
19
database/entity/index.ts
Normal file
19
database/entity/index.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Balance } from './Balance'
|
||||||
|
import { Migration } from './Migration'
|
||||||
|
import { Transaction } from './Transaction'
|
||||||
|
import { TransactionCreation } from './TransactionCreation'
|
||||||
|
import { TransactionSendCoin } from './TransactionSendCoin'
|
||||||
|
import { User } from './User'
|
||||||
|
import { UserSetting } from './UserSetting'
|
||||||
|
import { UserTransaction } from './UserTransaction'
|
||||||
|
|
||||||
|
export const entities = [
|
||||||
|
Balance,
|
||||||
|
Migration,
|
||||||
|
Transaction,
|
||||||
|
TransactionCreation,
|
||||||
|
TransactionSendCoin,
|
||||||
|
User,
|
||||||
|
UserSetting,
|
||||||
|
UserTransaction,
|
||||||
|
]
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { createConnection, Connection } from 'typeorm'
|
import { createConnection, Connection } from 'typeorm'
|
||||||
import CONFIG from '../config'
|
import CONFIG from '../config'
|
||||||
import path from 'path'
|
import { entities } from '../../entity/index'
|
||||||
|
|
||||||
const connection = async (): Promise<Connection | null> => {
|
const connection = async (): Promise<Connection | null> => {
|
||||||
let con = null
|
let con = null
|
||||||
@ -13,7 +13,7 @@ const connection = async (): Promise<Connection | null> => {
|
|||||||
username: CONFIG.DB_USER,
|
username: CONFIG.DB_USER,
|
||||||
password: CONFIG.DB_PASSWORD,
|
password: CONFIG.DB_PASSWORD,
|
||||||
database: CONFIG.DB_DATABASE,
|
database: CONFIG.DB_DATABASE,
|
||||||
entities: [path.join(__dirname, '..', '..', 'entity', '*.{ts,js}')],
|
entities,
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
})
|
})
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user