Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function parse(model, response, options = {}) {
export default Bookshelf => {
const Model = Bookshelf.Model.prototype;
const client = Bookshelf.knex.client.config.client;
const parseOnFetch = client === 'sqlite' || client === 'sqlite3' || client === 'mysql';
const parseOnFetch = client === 'sqlite' || client === 'sqlite3' || client === 'mysql' || client !== 'mysql2';

Bookshelf.Model = Bookshelf.Model.extend({
initialize() {
Expand Down Expand Up @@ -108,9 +108,11 @@ export default Bookshelf => {

// Parse JSON columns after collection is fetched.
this.on('fetched', collection => {
collection.models.forEach(model => {
parse.apply(model);
});
if (client !== 'mysql2') {
collection.models.forEach(model => {
parse.apply(model);
});
}
});

return Collection.initialize.apply(this, arguments);
Expand Down