introduced now_helper for multidb capabilities

This commit is contained in:
Gergo Torcsvari
2020-07-19 16:37:44 +02:00
parent f8edeb2775
commit a9e7222e5e
13 changed files with 62 additions and 37 deletions

View File

@ -0,0 +1,13 @@
const db = require('../db');
const config = require('config');
const Model = require('objection').Model;
Model.knex(db);
module.exports = function () {
if (config.database.knex && config.database.knex.client === 'sqlite3') {
return Model.raw('date(\'now\')');
} else {
return Model.raw('NOW()');
}
};