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 91501954
authored
Sep 20, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: change the use of destroy internally to match the correct signature
1 parent
73796549
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
22 deletions
lib/associations/has-many-double-linked.js
test/hooks.test.js
test/include/findAndCountAll.test.js
lib/associations/has-many-double-linked.js
View file @
9150195
...
...
@@ -115,11 +115,12 @@ module.exports = (function() {
});
var
where
=
{};
where
[
self
.
association
.
identifier
]
=
((
sourceKeys
.
length
===
1
)
?
self
.
instance
[
sourceKeys
[
0
]]
:
self
.
instance
.
id
);
where
[
foreignIdentifier
]
=
foreignIds
;
promises
.
push
(
self
.
association
.
through
.
model
.
destroy
(
where
,
options
));
promises
.
push
(
self
.
association
.
through
.
model
.
destroy
(
Utils
.
_
.
extend
(
options
,
{
where
:
where
})));
}
if
(
unassociatedObjects
.
length
>
0
)
{
...
...
test/hooks.test.js
View file @
9150195
...
...
@@ -3686,7 +3686,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeHook
).
to
.
be
.
true
expect
(
afterHook
).
to
.
be
.
true
done
()
...
...
@@ -3732,7 +3732,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeHook
).
to
.
be
.
true
expect
(
afterHook
).
to
.
be
.
true
done
()
...
...
@@ -3768,7 +3768,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
expect
(
beforeHook
).
to
.
be
.
true
expect
(
afterHook
).
to
.
be
.
true
...
...
@@ -3815,7 +3815,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
expect
(
beforeHook
).
to
.
be
.
true
expect
(
afterHook
).
to
.
be
.
true
...
...
@@ -3860,7 +3860,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
()
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
afterBulk
).
to
.
be
.
true
done
()
...
...
@@ -3874,7 +3874,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -3885,7 +3885,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -3915,7 +3915,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
()
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
afterBulk
).
to
.
be
.
true
done
()
...
...
@@ -3933,7 +3933,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -3948,7 +3948,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -3975,7 +3975,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
()
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
afterBulk
).
to
.
be
.
true
done
()
...
...
@@ -3989,7 +3989,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -4000,7 +4000,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -4030,7 +4030,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
()
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
success
(
function
()
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
success
(
function
()
{
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
afterBulk
).
to
.
be
.
true
done
()
...
...
@@ -4048,7 +4048,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -4063,7 +4063,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
fn
(
new
Error
(
'Whoops!'
))
})
this
.
User
.
destroy
({
username
:
'Cheech'
,
mood
:
'sad'
}).
error
(
function
(
err
)
{
this
.
User
.
destroy
({
where
:
{
username
:
'Cheech'
,
mood
:
'sad'
}
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
done
()
})
...
...
@@ -4126,7 +4126,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
this
.
User
.
bulkCreate
([
{
aNumber
:
1
},
{
aNumber
:
1
},
{
aNumber
:
1
}
]).
success
(
function
()
{
self
.
User
.
destroy
({
aNumber
:
1
},
{
individualHooks
:
true
}).
success
(
function
()
{
self
.
User
.
destroy
({
where
:
{
aNumber
:
1
},
individualHooks
:
true
}).
success
(
function
()
{
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
afterBulk
).
to
.
be
.
true
expect
(
beforeHook
).
to
.
be
.
true
...
...
@@ -4164,7 +4164,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
this
.
User
.
bulkCreate
([{
aNumber
:
1
},
{
aNumber
:
1
},
{
aNumber
:
1
}],
{
fields
:
[
'aNumber'
]
}).
success
(
function
()
{
self
.
User
.
destroy
({
aNumber
:
1
},
{
individualHooks
:
true
}).
error
(
function
(
err
)
{
self
.
User
.
destroy
({
where
:
{
aNumber
:
1
},
individualHooks
:
true
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
instanceOf
(
Error
)
expect
(
beforeBulk
).
to
.
be
.
true
expect
(
beforeHook
).
to
.
be
.
true
...
...
test/include/findAndCountAll.test.js
View file @
9150195
...
...
@@ -94,11 +94,11 @@ describe(Support.getTestDialectTeaser("Include"), function () {
]).
done
(
function
(
err
,
cs
)
{
expect
(
err
).
not
.
to
.
be
.
ok
;
expect
(
cs
).
to
.
be
.
length
(
1
)
// Delete some of conns to prove the concept
SomeConnection
.
destroy
({
SomeConnection
.
destroy
({
where
:
{
m
:
'A'
,
u
:
1
,
fk
:
[
1
,
2
],
}).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
}
}
).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
// Last and most important queries ( we connected 4, but deleted 2, witch means we must get 2 only )
A
.
findAndCountAll
({
...
...
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