2018-07-01 03:35:51 +03:00
|
|
|
require('dotenv').config();
|
|
|
|
|
2018-08-02 00:48:48 +03:00
|
|
|
const moment = require('moment-timezone');
|
|
|
|
moment.tz.setDefault('UTC');
|
|
|
|
|
2018-07-01 03:35:51 +03:00
|
|
|
module.exports = {
|
2018-08-02 00:48:48 +03:00
|
|
|
client: 'mysql2',
|
2018-07-01 03:35:51 +03:00
|
|
|
connection: {
|
|
|
|
host: process.env.DB_HOST,
|
|
|
|
user: process.env.DB_USER,
|
|
|
|
password: process.env.DB_PASSWORD,
|
2018-08-02 00:48:48 +03:00
|
|
|
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();
|
2018-07-09 03:12:49 +03:00
|
|
|
}
|
2018-07-01 03:35:51 +03:00
|
|
|
}
|
|
|
|
};
|