From 35cbb507a92be29e13de26d22ffc1c3e4fb83092 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Mon, 13 May 2019 15:49:51 +0200 Subject: [PATCH] Add dbSchema support for pg --- packages/strapi-hook-bookshelf/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js index 994951572a..a4543efff3 100644 --- a/packages/strapi-hook-bookshelf/lib/index.js +++ b/packages/strapi-hook-bookshelf/lib/index.js @@ -26,11 +26,12 @@ const GLOBALS = {}; const getDatabaseName = connection => { const dbName = _.get(connection.settings, 'database'); + const dbSchema = _.get(connection.settings, 'schema', 'public'); switch (_.get(connection.settings, 'client')) { case 'sqlite3': return 'main'; case 'pg': - return `${dbName}.public`; + return `${dbName}.${dbSchema}`; case 'mysql': return dbName; default: @@ -518,7 +519,6 @@ module.exports = function(strapi) { model: target[model], }) ); - } catch (err) { strapi.log.error( `Impossible to register the '${model}' model.`