blob: 27d9dbbae2345d138bde549862b3261d56ed0b76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const knex = require('knex')({
client: 'mysql2',
connection: {
host : process.env.DB_HOST,
user : process.env.DB_USER,
password : process.env.DB_PASS,
database : process.env.DB_NAME,
charset : 'utf8',
typecast : function (field, next) {
console.log(field.type)
if (field.type == 'BLOB') {
return field.string()
}
return next()
}
}
})
const bookshelf = require('bookshelf')(knex)
module.exports = {
bookshelf: bookshelf,
knex: knex,
}
|