summaryrefslogtreecommitdiff
path: root/bucky/db/bookshelf.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-08 02:18:49 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-08 02:18:49 +0100
commitbbbd8bbab8737f5067c85376daf79cd8a5a9c4cb (patch)
tree844d1385d7b88623eee3c2ea2c420280006ad349 /bucky/db/bookshelf.js
parente4e0cf21a31b74d5ee1e6d45b343ea60ed44f372 (diff)
parentdf674eef8e20c43426c0af5aa3d1a09b5e24c58a (diff)
merge
Diffstat (limited to 'bucky/db/bookshelf.js')
-rw-r--r--bucky/db/bookshelf.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/bucky/db/bookshelf.js b/bucky/db/bookshelf.js
new file mode 100644
index 0000000..69157cc
--- /dev/null
+++ b/bucky/db/bookshelf.js
@@ -0,0 +1,24 @@
+var 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()
+ }
+ }
+})
+
+var bookshelf = require('bookshelf')(knex)
+
+module.exports = {
+ bookshelf: bookshelf,
+ knex: knex,
+}