Skip to content

Commit 420ce97

Browse files
committed
release 0.7.9
1 parent 2410dc5 commit 420ce97

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

bookshelf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Bookshelf.js 0.7.8
1+
// Bookshelf.js 0.7.9
22
// ---------------
33

44
// (c) 2014 Tim Griesser
@@ -15,7 +15,7 @@ var Bookshelf = function() {
1515
// `Model` and `Collection` constructors for use in the current instance.
1616
Bookshelf.initialize = function(knex) {
1717
var bookshelf = {
18-
VERSION: '0.7.8'
18+
VERSION: '0.7.9'
1919
};
2020

2121
var _ = require('lodash');

browser/bookshelf.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bookshelf=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2-
// Bookshelf.js 0.7.8
2+
// Bookshelf.js 0.7.9
33
// ---------------
44

55
// (c) 2014 Tim Griesser
@@ -16,7 +16,7 @@ var Bookshelf = function() {
1616
// `Model` and `Collection` constructors for use in the current instance.
1717
Bookshelf.initialize = function(knex) {
1818
var bookshelf = {
19-
VERSION: '0.7.8'
19+
VERSION: '0.7.9'
2020
};
2121

2222
var _ = require('lodash');
@@ -1437,6 +1437,12 @@ _.extend(BookshelfRelation.prototype, {
14371437
selectConstraints: function(knex, options) {
14381438
var resp = options.parentResponse;
14391439

1440+
// The `belongsToMany` and `through` relations have joins & pivot columns.
1441+
if (this.isJoined()) this.joinClauses(knex);
1442+
1443+
// Call the function, if one exists, to constrain the eager loaded query.
1444+
if (options._beforeFn) options._beforeFn.call(knex, knex);
1445+
14401446
// The base select column
14411447
if (_.isArray(options.columns)) {
14421448
knex.columns(options.columns);
@@ -1448,12 +1454,8 @@ _.extend(BookshelfRelation.prototype, {
14481454
knex.column(this.targetTableName + '.*');
14491455
}
14501456

1451-
// The `belongsToMany` and `through` relations have joins & pivot columns.
1452-
if (this.isJoined()) {
1453-
this.joinClauses(knex);
1454-
this.joinColumns(knex);
1455-
}
1456-
1457+
if (this.isJoined()) this.joinColumns(knex);
1458+
14571459
// If this is a single relation and we're not eager loading,
14581460
// limit the query to a single item.
14591461
if (this.isSingle() && !resp) knex.limit(1);
@@ -1856,28 +1858,28 @@ _.extend(Sync.prototype, {
18561858
select: Promise.method(function() {
18571859
var columns, sync = this,
18581860
options = this.options, relatedData = this.syncing.relatedData;
1861+
var knex = this.query;
18591862

18601863
// Inject all appropriate select costraints dealing with the relation
18611864
// into the `knex` query builder for the current instance.
18621865
if (relatedData) {
1863-
relatedData.selectConstraints(this.query, options);
1866+
relatedData.selectConstraints(knex, options);
18641867
} else {
18651868
columns = options.columns;
1869+
// Call the function, if one exists, to constrain the eager loaded query.
1870+
if (options._beforeFn) options._beforeFn.call(knex, knex);
18661871
if (!_.isArray(columns)) columns = columns ? [columns] : [_.result(this.syncing, 'tableName') + '.*'];
18671872
}
18681873

18691874
// Set the query builder on the options, in-case we need to
18701875
// access in the `fetching` event handlers.
1871-
options.query = this.query;
1872-
1873-
// Call the function, if one exists, to constrain the eager loaded query.
1874-
if (options._beforeFn) options._beforeFn.call(this.syncing, options.query);
1876+
options.query = knex;
18751877

18761878
// Trigger a `fetching` event on the model, and then select the appropriate columns.
18771879
return Promise.bind(this).then(function() {
18781880
return this.syncing.triggerThen('fetching', this.syncing, columns, options);
18791881
}).then(function() {
1880-
return this.query.select(columns);
1882+
return knex.select(columns);
18811883
});
18821884
}),
18831885

index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<div id="sidebar" class="interface">
2828

2929
<a class="toc_title" href="#">
30-
Bookshelf.js <span class="version">(0.7.8)</span>
30+
Bookshelf.js <span class="version">(0.7.9)</span>
3131
</a>
3232
<ul class="toc_section">
3333
<li>&raquo; <a href="http://github.com/tgriesser/bookshelf">GitHub Repository</a></li>
@@ -195,7 +195,7 @@
195195
and has a comprehensive <a href="https://travis-ci.org/tgriesser/bookshelf">test suite</a>.
196196
</p>
197197

198-
<h2>Latest Release: 0.7.8 - <span class="small"><a href="#changelog">Change Log</a></span></h2>
198+
<h2>Latest Release: 0.7.9 - <span class="small"><a href="#changelog">Change Log</a></span></h2>
199199

200200
<p>
201201
Current Develop &mdash;
@@ -2338,6 +2338,13 @@ <h2 id="faq">F.A.Q.</h2>
23382338

23392339
<h2 id="changelog">Change Log</h2>
23402340

2341+
<p>
2342+
<b class="header">0.7.9</b> &mdash; <small><i>Oct 28, 2014</i></small> &mdash; <a href="https://github.com/tgriesser/bookshelf/compare/0.7.8...0.7.9">Diff</a><br />
2343+
</p>
2344+
<ul>
2345+
<li>Fix for regression in columns / eager fetch query constraints, (#510).</li>
2346+
</ul>
2347+
23412348
<p>
23422349
<b class="header">0.7.8</b> &mdash; <small><i>Oct 28, 2014</i></small> &mdash; <a href="https://github.com/tgriesser/bookshelf/compare/0.7.7...0.7.8">Diff</a><br />
23432350
</p>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bookshelf",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3",
55
"main": "bookshelf.js",
66
"scripts": {

0 commit comments

Comments
 (0)