不要怂,就是干,撸起袖子干!

Commit 8ec14ede by Mick Hansen

fix(includes): fixes issue where a main join is not propagated properly to the m…

…ain query because parents are in subquery (closes #1938)
1 parent 92b6b2ba
...@@ -875,11 +875,14 @@ module.exports = (function() { ...@@ -875,11 +875,14 @@ module.exports = (function() {
if (childInclude.subQuery && subQuery) { if (childInclude.subQuery && subQuery) {
joinQueries.subQuery = joinQueries.subQuery.concat(childJoinQueries.subQuery); joinQueries.subQuery = joinQueries.subQuery.concat(childJoinQueries.subQuery);
} else { }
if (childJoinQueries.mainQuery) {
joinQueries.mainQuery = joinQueries.mainQuery.concat(childJoinQueries.mainQuery); joinQueries.mainQuery = joinQueries.mainQuery.concat(childJoinQueries.mainQuery);
} }
}.bind(this)); }.bind(this));
} }
return joinQueries; return joinQueries;
}; };
...@@ -889,6 +892,7 @@ module.exports = (function() { ...@@ -889,6 +892,7 @@ module.exports = (function() {
subJoinQueries = subJoinQueries.concat(joinQueries.subQuery); subJoinQueries = subJoinQueries.concat(joinQueries.subQuery);
mainJoinQueries = mainJoinQueries.concat(joinQueries.mainQuery); mainJoinQueries = mainJoinQueries.concat(joinQueries.mainQuery);
}.bind(this)); }.bind(this));
} }
......
...@@ -83,7 +83,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -83,7 +83,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}); });
}); });
it.only('should support many levels of belongsTo (with a lower level having a where)', function (done) { it('should support many levels of belongsTo (with a lower level having a where)', function (done) {
var A = this.sequelize.define('A', {}) var A = this.sequelize.define('A', {})
, B = this.sequelize.define('B', {}) , B = this.sequelize.define('B', {})
, C = this.sequelize.define('C', {}) , C = this.sequelize.define('C', {})
...@@ -169,8 +169,6 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -169,8 +169,6 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(err).not.to.be.ok; expect(err).not.to.be.ok;
expect(a.b.c.d.e.f.g.h).to.be.ok; expect(a.b.c.d.e.f.g.h).to.be.ok;
done(); done();
}).on('sql', function (sql) {
console.log(sql);
}); });
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!