3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00
zeppelin/knexfile.js
Dragory 94c8e1cf43 Switch from node-mariasql to mysql2
Node-mariasql returned dates in an incorrect timezone, and the project
doesn't seem to be actively maintained. Switching to mysql2 fixes the issue.
2018-08-02 00:48:48 +03:00

23 lines
521 B
JavaScript

require('dotenv').config();
const moment = require('moment-timezone');
moment.tz.setDefault('UTC');
module.exports = {
client: 'mysql2',
connection: {
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
charset: 'utf8mb4',
timezone: 'UTC',
typeCast(field, next) {
if (field.type === 'DATETIME') {
return moment(field.string()).format('YYYY-MM-DD HH:mm:ss');
}
return next();
}
}
};