2016-06-18 21:53:18 +02:00
|
|
|
'use strict';
|
2016-10-26 10:43:11 +02:00
|
|
|
|
2016-06-18 21:53:18 +02:00
|
|
|
const knex = require('knex');
|
2014-10-21 15:28:10 +02:00
|
|
|
|
2016-11-13 15:15:33 +01:00
|
|
|
module.exports.createDb = function ({ databaseUri, poolMin = 2, poolMax = 20, databaseSchema = 'public' }) {
|
2016-11-12 11:21:40 +01:00
|
|
|
const db = knex({
|
2014-11-14 15:06:53 +01:00
|
|
|
client: 'pg',
|
2016-11-13 15:15:33 +01:00
|
|
|
connection: databaseUri,
|
|
|
|
pool: { min: poolMin, max: poolMax },
|
|
|
|
searchPath: databaseSchema,
|
2014-11-14 15:06:53 +01:00
|
|
|
});
|
2016-11-12 11:21:40 +01:00
|
|
|
|
|
|
|
return db;
|
2016-05-01 22:53:09 +02:00
|
|
|
};
|