mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Disable knex useNullAsDefault warning
refs #6623 - automatically set useNullAsDefault to false for sqlite3 so that we don't get a warning - we should *not* be relying on the behaviour of interpretting undefined anywhere, so it is correct that an error should be output if this happens so that we can fix the bad behaviour
This commit is contained in:
parent
192086bd98
commit
8c74f55b36
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