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 0c4ddcd8
authored
Jun 19, 2015
by
Jason Murad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for cascade-delete-with-hooks when has-zero-or-one
1 parent
ce5c338c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
test/integration/associations/has-one.test.js
test/integration/associations/has-one.test.js
View file @
0c4ddcd
...
...
@@ -381,6 +381,21 @@ describe(Support.getTestDialectTeaser('HasOne'), function() {
});
});
it
(
'works when cascading a delete with hooks but there is no associate (i.e. "has zero")'
,
function
()
{
var
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
title
:
Sequelize
.
STRING
})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
});
User
.
hasOne
(
Task
,
{
onDelete
:
'cascade'
,
hooks
:
true
});
return
User
.
sync
({
force
:
true
}).
then
(
function
()
{
return
Task
.
sync
({
force
:
true
}).
then
(
function
()
{
return
User
.
create
({
username
:
'foo'
}).
then
(
function
(
user
)
{
return
user
.
destroy
();
});
});
});
});
// NOTE: mssql does not support changing an autoincrement primary key
if
(
Support
.
getTestDialect
()
!==
'mssql'
)
{
it
(
'can cascade updates'
,
function
()
{
...
...
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