-
Notifications
You must be signed in to change notification settings - Fork 3
/
knexfile.js
97 lines (92 loc) · 2.78 KB
/
knexfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict';
module.exports = {
development: {
client: 'mysql',
connection: {
database: 'hapi_knex_dev',
user: 'root',
password: '',
charset: 'utf8',
// This is used to type cast server date/time values to JavaScript Date object and vice versa
timezone: 'UTC',
dateStrings: true,
supportBigNumbers: true,
typeCast: function (field, next) {
if (field.type == 'TIMESTAMP') {
let val = field.string();
try {
return new Date(val + ' GMT').toISOString();
} catch (e) {
return val;
}
}
return next();
}
},
pool: {
min: 2,
max: 400,
afterCreate: function (connection, callback) {
connection.query('SET time_zone = "+00:00";', function (err) {
callback(err, connection);
})
}
},
acquireConnectionTimeout: 90000,
asyncStackTraces: true,
migrations: {
directory: './knex/migrations',
tableName: 'knex_migrations'
},
seeds: {
directory: './knex/seeds',
},
log: {
warn(message) { },
error(message) { },
deprecate(message) { },
debug(message) { },
}
},
production: {
client: 'mysql',
connection: {
database: 'hapi_knex_prod',
user: 'root',
password: '',
charset: 'utf8',
// This is used to type cast server date/time values to JavaScript Date object and vice versa
timezone: 'UTC',
dateStrings: true,
supportBigNumbers: true,
typeCast: function (field, next) {
if (field.type == 'TIMESTAMP') {
let val = field.string();
try {
return new Date(val + ' GMT').toISOString();
} catch (e) {
return val;
}
}
return next();
}
},
pool: {
min: 2,
max: 400,
afterCreate: function (connection, callback) {
connection.query('SET time_zone = "+00:00";', function (err) {
callback(err, connection);
})
}
},
acquireConnectionTimeout: 90000,
migrations: {
directory: './knex/migrations',
tableName: 'knex_migrations'
},
seeds: {
directory: './knex/seeds'
}
}
}