2018-10-26 06:41:20 +03:00
|
|
|
require('dotenv').config();
|
|
|
|
|
|
|
|
const moment = require('moment-timezone');
|
|
|
|
moment.tz.setDefault('UTC');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
type: "mysql",
|
|
|
|
host: process.env.DB_HOST,
|
|
|
|
username: process.env.DB_USER,
|
|
|
|
password: process.env.DB_PASSWORD,
|
|
|
|
database: process.env.DB_DATABASE,
|
|
|
|
charset: 'utf8mb4',
|
|
|
|
supportBigNumbers: true,
|
|
|
|
bigNumberStrings: true,
|
|
|
|
dateStrings: true,
|
|
|
|
synchronize: false,
|
|
|
|
|
|
|
|
// Entities
|
|
|
|
entities: [`${__dirname}/src/data/entities/*.ts`],
|
|
|
|
|
|
|
|
// Pool options
|
|
|
|
extra: {
|
|
|
|
typeCast(field, next) {
|
|
|
|
if (field.type === 'DATETIME') {
|
|
|
|
const val = field.string();
|
|
|
|
return val != null ? moment(val).format('YYYY-MM-DD HH:mm:ss') : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return next();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Migrations
|
2018-12-14 06:45:50 +02:00
|
|
|
migrations: ["src/migrations/*.ts"],
|
2018-10-26 06:41:20 +03:00
|
|
|
cli: {
|
2018-12-14 06:45:50 +02:00
|
|
|
migrationsDir: "src/migrations"
|
2018-10-26 06:41:20 +03:00
|
|
|
},
|
|
|
|
};
|