0
Fork 0
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:
Hannah Wolfe 2016-03-24 12:49:06 +00:00
parent 192086bd98
commit 8c74f55b36

View file

@ -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;