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

Commit ec62941a by paul-sh

Fix: Model.count() and findAndCountAll() returned NaN with Postgres and quoteIdentifiers==false.

1 parent 60ab9024
Showing with 14 additions and 4 deletions
......@@ -865,7 +865,7 @@ module.exports = (function() {
options.includeIgnoreAttributes = false;
options.limit = null;
return this.aggregate(col, 'COUNT', options);
return this.aggregate(col, 'count', options);
};
/**
......
......@@ -536,13 +536,22 @@ if (dialect.match(/^postgres/)) {
where: {fullName: "John Smith"}
})
.success(function(user2) {
self.sequelize.options.quoteIndentifiers = true
self.sequelize.getQueryInterface().QueryGenerator.options.quoteIdentifiers = true
self.sequelize.options.logging = false
// We can map values back to non-quoted identifiers
expect(user2.id).to.equal(user.id)
expect(user2.username).to.equal('user')
expect(user2.fullName).to.equal('John Smith')
// We can query and aggregate by non-quoted identifiers
self.User
.count({
where: {fullName: "John Smith"}
})
.success(function(count) {
self.sequelize.options.quoteIndentifiers = true
self.sequelize.getQueryInterface().QueryGenerator.options.quoteIdentifiers = true
self.sequelize.options.logging = false
expect(count).to.equal(1)
done()
})
})
......@@ -550,4 +559,5 @@ if (dialect.match(/^postgres/)) {
})
})
})
})
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!