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

Commit c02d62c1 by Mick Hansen

fix: dont assume array as response

1 parent 5eef5803
Showing with 6 additions and 3 deletions
...@@ -1379,9 +1379,12 @@ module.exports = (function() { ...@@ -1379,9 +1379,12 @@ module.exports = (function() {
// Insert all records at once // Insert all records at once
return self.QueryInterface.bulkInsert(self.getTableName(options), records, options, attributes).then(function (results) { return self.QueryInterface.bulkInsert(self.getTableName(options), records, options, attributes).then(function (results) {
return results.forEach(function (result, i) { if (Array.isArray(results)) {
daos[i].set(self.primaryKeyAttribute, result[self.rawAttributes[self.primaryKeyAttribute].field], {raw: true}); results.forEach(function (result, i) {
}); daos[i].set(self.primaryKeyAttribute, result[self.rawAttributes[self.primaryKeyAttribute].field], {raw: true});
});
}
return results;
}); });
} }
}).then(function() { }).then(function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!