2017-05-28 16:49:00 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-07-26 15:05:49 +00:00
|
|
|
const config = require('./config');
|
2019-01-04 20:31:01 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const knexConstructor = require('knex');
|
2017-05-28 16:49:00 +00:00
|
|
|
|
2018-11-18 20:31:22 +00:00
|
|
|
const knex = require('knex')({
|
2018-12-30 23:58:17 +00:00
|
|
|
client: 'mysql',
|
2018-11-20 22:41:10 +00:00
|
|
|
connection: {
|
|
|
|
...config.mysql,
|
|
|
|
|
|
|
|
// DATE and DATETIME types contain no timezone info. The MySQL driver tries to interpret them w.r.t. to local time, which
|
|
|
|
// does not work well with assigning these values in UTC and handling them as if in UTC
|
|
|
|
dateStrings: [
|
|
|
|
'DATE',
|
|
|
|
'DATETIME'
|
|
|
|
]
|
|
|
|
},
|
2017-05-28 16:49:00 +00:00
|
|
|
migrations: {
|
2019-01-04 20:31:01 +00:00
|
|
|
directory: path.join(__dirname, '..', 'setup', 'knex', 'migrations')
|
2017-05-28 16:49:00 +00:00
|
|
|
}
|
2019-01-04 20:31:01 +00:00
|
|
|
//, debug: true
|
2017-05-28 16:49:00 +00:00
|
|
|
});
|
|
|
|
|
2019-06-29 21:19:56 +00:00
|
|
|
/*
|
|
|
|
This is to enable logging on mysql side:
|
|
|
|
SET GLOBAL general_log = 'ON';
|
|
|
|
SET GLOBAL general_log_file = '/tmp/mysql-all.log';
|
|
|
|
*/
|
|
|
|
|
2018-11-20 22:41:10 +00:00
|
|
|
|
|
|
|
|
2017-05-28 16:49:00 +00:00
|
|
|
module.exports = knex;
|