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

Commit 33becdf7 by Mick Hansen

Merge pull request #2404 from suisha/1.7.0

Include options when calling destroy on a paranoid table
2 parents 3563869b 75d8e353
Showing with 24 additions and 2 deletions
......@@ -994,7 +994,7 @@ module.exports = (function() {
var attrValueHash = {}
attrValueHash[self._timestampAttributes.deletedAt] = Utils.now()
query = 'bulkUpdate'
args = [self.tableName, attrValueHash, where]
args = [self.tableName, attrValueHash, where, options]
} else {
query = 'bulkDelete'
args = [self.tableName, where, options]
......
......@@ -791,7 +791,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
describe('destroy', function() {
it('supports transactions', function(done) {
it('supports transactions for non-paranoid tables', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING })
......@@ -813,6 +813,28 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it('supports transactions for paranoid tables', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING }, { paranoid: true })
User.sync({ force: true }).success(function() {
User.create({ username: 'foo' }).success(function() {
sequelize.transaction(function(t) {
User.destroy({}, { transaction: t }).success(function() {
User.count().success(function(count1) {
User.count({ transaction: t }).success(function(count2) {
expect(count1).to.equal(1)
expect(count2).to.equal(0)
t.rollback().success(function(){ done() })
})
})
})
})
})
})
})
})
it('deletes values that match filter', function(done) {
var self = this
, data = [{ username: 'Peter', secretValue: '42' },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!