Skip to content

Commit 9c584de

Browse files
committed
switch to pg.Client
1 parent ef34ff3 commit 9c584de

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/util/migration_handler.ts

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

44
export async function applyMigrations(config: any): Promise<void> {
5-
const pool = new Pool(config)
6-
await migrate({ client: pool }, __dirname + '/migrations')
5+
const client = new Client(config)
6+
await client.connect()
7+
try {
8+
await migrate({ client }, __dirname + '/migrations')
9+
} finally {
10+
await client.end()
11+
}
712
}

0 commit comments

Comments
 (0)