summaryrefslogtreecommitdiff
path: root/bucky/db/bookshelf.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-25 17:36:53 -0400
committerJules Laplace <jules@okfoc.us>2015-09-25 17:36:53 -0400
commit3aa171fbaf05d0ee5b82673443da51ed43719475 (patch)
tree291426c3102cffff23f8b202ec14cd03df91e799 /bucky/db/bookshelf.js
parentccd2a51e9206aa858313ae97550b09b9bf8476db (diff)
moving things around
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,
+}