mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Merge pull request #6637 from ErisDS/knex-config
Disable knex useNullAsDefault warning
This commit is contained in:
commit
e72dddbf97
1 changed files with 10 additions and 4 deletions
|
@ -3,8 +3,9 @@ var knex = require('knex'),
|
|||
dbConfig = config.database,
|
||||
knexInstance;
|
||||
|
||||
function configureDriver(client) {
|
||||
var pg;
|
||||
function configure(dbConfig) {
|
||||
var client = dbConfig.client,
|
||||
pg;
|
||||
|
||||
if (client === 'pg' || client === 'postgres' || client === 'postgresql') {
|
||||
try {
|
||||
|
@ -20,11 +21,16 @@ function configureDriver(client) {
|
|||
return val === null ? null : parseInt(val, 10);
|
||||
});
|
||||
}
|
||||
|
||||
if (client === 'sqlite3') {
|
||||
dbConfig.useNullAsDefault = false;
|
||||
}
|
||||
|
||||
return dbConfig;
|
||||
}
|
||||
|
||||
if (!knexInstance && dbConfig && dbConfig.client) {
|
||||
configureDriver(dbConfig.client);
|
||||
knexInstance = knex(dbConfig);
|
||||
knexInstance = knex(configure(dbConfig));
|
||||
}
|
||||
|
||||
module.exports = knexInstance;
|
||||
|
|
Loading…
Add table
Reference in a new issue