From 149c1f7737c4a06dcfe5675b3106f89801045283 Mon Sep 17 00:00:00 2001 From: kabaros Date: Thu, 30 Apr 2020 14:10:13 +0100 Subject: [PATCH] Preserve pool setttings when there is a schema In the case where this is a schema defined, `options.pool` is reassigned ignoring the object constructed in a previous step (only preserving min and max, but not the other values such as `createTimeoutMillis` etc... This change is to keep the other values intact. Signed-off-by: mozafar --- packages/strapi-connector-bookshelf/lib/knex.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/strapi-connector-bookshelf/lib/knex.js b/packages/strapi-connector-bookshelf/lib/knex.js index 2545d2968a..70ea60696a 100644 --- a/packages/strapi-connector-bookshelf/lib/knex.js +++ b/packages/strapi-connector-bookshelf/lib/knex.js @@ -178,8 +178,7 @@ module.exports = strapi => { if (_.isString(_.get(options.connection, 'schema'))) { options.pool = { - min: _.get(connection.options, 'pool.min') || 0, - max: _.get(connection.options, 'pool.max') || 10, + ...options.pool, afterCreate: (conn, cb) => { conn.query( `SET SESSION SCHEMA '${options.connection.schema}';`,