Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 75d8e353
authored
Oct 07, 2014
by
David Mai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include options when calling destroy on a paranoid table
1 parent
3563869b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
lib/dao-factory.js
test/dao-factory.test.js
lib/dao-factory.js
View file @
75d8e35
...
@@ -994,7 +994,7 @@ module.exports = (function() {
...
@@ -994,7 +994,7 @@ module.exports = (function() {
var
attrValueHash
=
{}
var
attrValueHash
=
{}
attrValueHash
[
self
.
_timestampAttributes
.
deletedAt
]
=
Utils
.
now
()
attrValueHash
[
self
.
_timestampAttributes
.
deletedAt
]
=
Utils
.
now
()
query
=
'bulkUpdate'
query
=
'bulkUpdate'
args
=
[
self
.
tableName
,
attrValueHash
,
where
]
args
=
[
self
.
tableName
,
attrValueHash
,
where
,
options
]
}
else
{
}
else
{
query
=
'bulkDelete'
query
=
'bulkDelete'
args
=
[
self
.
tableName
,
where
,
options
]
args
=
[
self
.
tableName
,
where
,
options
]
...
...
test/dao-factory.test.js
View file @
75d8e35
...
@@ -791,7 +791,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -791,7 +791,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
describe
(
'destroy'
,
function
()
{
describe
(
'destroy'
,
function
()
{
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions
for non-paranoid tables
'
,
function
(
done
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
})
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
})
...
@@ -813,6 +813,28 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -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
)
{
it
(
'deletes values that match filter'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
,
data
=
[{
username
:
'Peter'
,
secretValue
:
'42'
},
,
data
=
[{
username
:
'Peter'
,
secretValue
:
'42'
},
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment