コメント追加したり
This commit is contained in:
parent
1c45e759c3
commit
b9575d2c5b
22 changed files with 945 additions and 809 deletions
|
@ -8,7 +8,13 @@ export const entities = [
|
|||
UsedToken,
|
||||
];
|
||||
|
||||
/**
|
||||
* データベース接続が既に存在すれば取得し、なければ新規作成する
|
||||
* @param force 既存の接続があっても新規作成するかどうか
|
||||
* @returns 取得または作成したDBコネクション
|
||||
*/
|
||||
export const initDb = async (force = false): Promise<Connection> => {
|
||||
// forceがtrueでない限り、既に接続が存在する場合はそれを返す
|
||||
if (!force) {
|
||||
try {
|
||||
const conn = getConnection();
|
||||
|
@ -19,6 +25,7 @@ export const initDb = async (force = false): Promise<Connection> => {
|
|||
}
|
||||
}
|
||||
|
||||
// 接続がないか、forceがtrueの場合は新規作成する
|
||||
return createConnection({
|
||||
type: 'postgres',
|
||||
host: config.db.host,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue