mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
33 lines
738 B
JavaScript
33 lines
738 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',
|
|
supportBigNumbers: true,
|
|
bigNumberStrings: true,
|
|
dateStrings: true,
|
|
typeCast(field, next) {
|
|
if (field.type === 'DATETIME') {
|
|
return moment(field.string()).format('YYYY-MM-DD HH:mm:ss');
|
|
}
|
|
|
|
return next();
|
|
}
|
|
},
|
|
pool: {
|
|
afterCreate(conn, cb) {
|
|
conn.query('SET time_zone = "+00:00";', err => {
|
|
cb(err, conn);
|
|
});
|
|
}
|
|
}
|
|
};
|