We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef34ff3 commit 9c584deCopy full SHA for 9c584de
source/util/migration_handler.ts
@@ -1,7 +1,12 @@
1
-import { Pool } from 'pg'
+import { Client } from 'pg'
2
import { migrate } from 'postgres-migrations'
3
4
export async function applyMigrations(config: any): Promise<void> {
5
- const pool = new Pool(config)
6
- await migrate({ client: pool }, __dirname + '/migrations')
+ const client = new Client(config)
+ await client.connect()
7
+ try {
8
+ await migrate({ client }, __dirname + '/migrations')
9
+ } finally {
10
+ await client.end()
11
+ }
12
}
0 commit comments