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

Commit f1ca537c by Mick Hansen

solve a few include with schema cases

1 parent cb8b481d
......@@ -580,7 +580,6 @@ module.exports = (function() {
, subQueryAttributes = null
, subJoinQueries = []
// Escape table
options.table = table = !Array.isArray(tableName) ? this.quoteTable(tableName) : tableName.map(function(t) {
return this.quoteTable(t)
}.bind(this)).join(", ")
......@@ -761,8 +760,9 @@ module.exports = (function() {
// If its a multi association we need to add a where query to the main where (executed in the subquery)
if (subQuery && association.isMultiAssociation) {
if (!options.where) options.where = {}
// Creating the as-is where for the subQuery, checks that the required association exists
options.where["__"+as] = self.sequelize.asIs("(SELECT "+self.quoteIdentifier(attrRight)+" FROM " + self.quoteIdentifier(tableRight) + " WHERE " + where + " LIMIT 1) IS NOT NULL")
options.where["__"+as] = self.sequelize.asIs("(SELECT "+self.quoteIdentifier(attrRight)+" FROM " + self.quoteTable(table) + " as " + self.quoteTable(as) + " WHERE " + where + " LIMIT 1) IS NOT NULL")
}
}
}
......
......@@ -403,7 +403,7 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
]}
],
order: [
['AccUsers.id', 'ASC']
['account.AccUsers.id', 'ASC']
]
}).done(function (err, users) {
expect(err).not.to.be.ok
......@@ -1404,7 +1404,7 @@ it('should be possible to extend the on clause with a where option on a hasOne i
],
limit: 3,
order: [
[self.sequelize.col(self.models.Product.tableName+'.id'), 'ASC']
[self.sequelize.col(self.models.Product.getTableName()+'.id'), 'ASC']
]
}).done(function (err, products) {
expect(err).not.to.be.ok
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!