From 8a779bb0905f1b83a89478b5c543cc10c04e2e8e Mon Sep 17 00:00:00 2001 From: Ricardo Nogueira Date: Sat, 4 Jun 2016 22:46:42 +0100 Subject: [PATCH] wip --- .travis.yml | 1 + src/index.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c46ce40..979f34f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js before_script: + - psql --version - cp test/postgres/knexfile.js.dist test/postgres/knexfile.js - cp test/sqlite/knexfile.js.dist test/sqlite/knexfile.js - psql -U postgres -c 'create database "bookshelf-json-columns";' diff --git a/src/index.js b/src/index.js index dbdaaf8..9f7ae1e 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,6 @@ */ function stringify() { - console.log('stringify'); this.jsonColumns.forEach(column => { if (this.attributes[column]) { this.attributes[column] = JSON.stringify(this.attributes[column]); @@ -17,7 +16,6 @@ function stringify() { */ function parse() { - console.log('parse'); this.jsonColumns.forEach(column => { if (this.attributes[column]) { this.attributes[column] = JSON.parse(this.attributes[column]); @@ -36,9 +34,12 @@ export default Bookshelf => { Bookshelf.Model = Bookshelf.Model.extend({ initialize() { if (!this.jsonColumns) { + console.log('foo'); return Model.initialize.apply(this, arguments); } + console.log('bar'); + // Stringify JSON columns before model is saved. this.on('saving', stringify.bind(this));