From f8803b78757f1f88786861d01b9b0337facf895b Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Sun, 30 Sep 2018 16:17:31 +0100 Subject: [PATCH] Move db to pg-promise --- app/src/db.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/db.js b/app/src/db.js index fcd7d4dc..b813c295 100644 --- a/app/src/db.js +++ b/app/src/db.js @@ -8,10 +8,11 @@ * PGPASSWORD=null * PGPORT=5432 */ -import { Pool } from 'pg'; +import pg from 'pg-promise'; -const pool = new Pool() +// pg-promise, can provide initialisation options +const pgp = pg(); +// database connection, can provide connection string or object (should default to env vars) +const db = pgp(); -const query = (text, params) => pool.query(text, params); - -export { pool, query } +export default db;