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

Commit 3aab4110 by Mick Hansen

Merge pull request #1343 from janmeier/bulkCreateLength

Handle models with a column named length in bulkcreate - Closes #1338
2 parents cec519bf 6ce0bef1
......@@ -182,7 +182,7 @@ module.exports = (function() {
, allAttributes = []
Utils._.forEach(attrValueHashes, function(attrValueHash, i) {
Utils._.forEach(attrValueHash, function(value, key, hash) {
Utils._.forOwn(attrValueHash, function(value, key, hash) {
if (allAttributes.indexOf(key) === -1) allAttributes.push(key)
})
})
......
......@@ -274,7 +274,7 @@ module.exports = (function() {
, allAttributes = []
Utils._.forEach(attrValueHashes, function(attrValueHash, i) {
Utils._.forEach(attrValueHash, function(value, key, hash) {
Utils._.forOwn(attrValueHash, function(value, key, hash) {
if (allAttributes.indexOf(key) === -1) allAttributes.push(key)
if (tables[tableName] && tables[tableName][key]) {
......
......@@ -178,7 +178,7 @@ module.exports = (function() {
, allAttributes = []
Utils._.forEach(attrValueHashes, function(attrValueHash, i) {
Utils._.forEach(attrValueHash, function(value, key, hash) {
Utils._.forOwn(attrValueHash, function(value, key, hash) {
if (allAttributes.indexOf(key) === -1) allAttributes.push(key)
})
})
......
......@@ -911,6 +911,18 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it('properly handles a model with a length column', function (done) {
var UserWithLength = this.sequelize.define('UserWithLength', {
length: Sequelize.INTEGER
})
UserWithLength.sync({force:true}).success(function() {
UserWithLength.bulkCreate([{ length: 42}, {length: 11}]).success(function () {
done()
})
})
})
it('stores the current date in createdAt', function(done) {
var self = this
, data = [{ username: 'Peter'},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!