mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 01:09:49 +00:00
Add dbSchema support for pg
This commit is contained in:
parent
e18d2b9f05
commit
35cbb507a9
@ -26,11 +26,12 @@ const GLOBALS = {};
|
|||||||
|
|
||||||
const getDatabaseName = connection => {
|
const getDatabaseName = connection => {
|
||||||
const dbName = _.get(connection.settings, 'database');
|
const dbName = _.get(connection.settings, 'database');
|
||||||
|
const dbSchema = _.get(connection.settings, 'schema', 'public');
|
||||||
switch (_.get(connection.settings, 'client')) {
|
switch (_.get(connection.settings, 'client')) {
|
||||||
case 'sqlite3':
|
case 'sqlite3':
|
||||||
return 'main';
|
return 'main';
|
||||||
case 'pg':
|
case 'pg':
|
||||||
return `${dbName}.public`;
|
return `${dbName}.${dbSchema}`;
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
return dbName;
|
return dbName;
|
||||||
default:
|
default:
|
||||||
@ -518,7 +519,6 @@ module.exports = function(strapi) {
|
|||||||
model: target[model],
|
model: target[model],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
strapi.log.error(
|
strapi.log.error(
|
||||||
`Impossible to register the '${model}' model.`
|
`Impossible to register the '${model}' model.`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user