Skip to content

Commit ef34ff3

Browse files
committed
use pg connection pool instead
1 parent e29c773 commit ef34ff3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

source/util/migration_handler.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1+
import { Pool } from 'pg'
12
import { migrate } from 'postgres-migrations'
23

34
export async function applyMigrations(config: any): Promise<void> {
4-
const dbConfig = {
5-
database: config['database'] || 'postgres',
6-
user: config['user'] || 'postgres',
7-
password: config['password'] || 'postgres',
8-
host: config['host'] || 'localhost',
9-
port: config['port'] || 5432,
10-
}
11-
await migrate(dbConfig, __dirname + '/migrations')
5+
const pool = new Pool(config)
6+
await migrate({ client: pool }, __dirname + '/migrations')
127
}

0 commit comments

Comments
 (0)