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 c56a9afe
authored
Jan 06, 2014
by
maximeCony
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For the paranoidClause function, prevent that deletedAt is overwritten when the …
…where option is an array
1 parent
b3b879b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
lib/dao-factory.js
lib/dao-factory.js
View file @
c56a9af
...
@@ -1191,17 +1191,27 @@ module.exports = (function() {
...
@@ -1191,17 +1191,27 @@ module.exports = (function() {
options
.
where
=
options
.
where
||
{}
options
.
where
=
options
.
where
||
{}
var
deletedAtCol
=
Utils
.
_
.
underscoredIf
(
this
.
options
.
deletedAt
,
this
.
options
.
underscored
)
var
deletedAtCol
=
Utils
.
_
.
underscoredIf
(
this
.
options
.
deletedAt
,
this
.
options
.
underscored
)
,
quoteIdentifiedDeletedAtCol
=
this
.
QueryInterface
.
quoteIdentifier
(
deletedAtCol
)
// Don't overwrite our explicit deletedAt search value if we provide one
// Don't overwrite our explicit deletedAt search value if we provide one
if
(
!!
options
.
where
[
deletedAtCol
])
{
if
(
!!
options
.
where
[
deletedAtCol
])
{
return
options
return
options
}
}
if
(
this
.
tableName
)
{
quoteIdentifiedDeletedAtCol
=
this
.
QueryInterface
.
quoteIdentifier
(
this
.
tableName
)
+
'.'
+
quoteIdentifiedDeletedAtCol
}
if
(
typeof
options
.
where
===
"string"
)
{
if
(
typeof
options
.
where
===
"string"
)
{
options
.
where
+=
' AND '
+
this
.
QueryInterface
.
quoteIdentifier
(
deletedAtCol
)
+
' IS NULL '
options
.
where
+=
' AND '
+
quoteIdentifiedDeletedAtCol
+
' IS NULL '
}
}
else
if
(
Array
.
isArray
(
options
.
where
))
{
else
if
(
Array
.
isArray
(
options
.
where
))
{
options
.
where
[
0
]
+=
' AND '
+
this
.
QueryInterface
.
quoteIdentifier
(
deletedAtCol
)
+
' IS NULL '
// Don't overwrite our explicit deletedAt search value if we provide one
if
(
options
.
where
[
0
].
indexOf
(
deletedAtCol
)
!==
-
1
)
{
return
options
}
options
.
where
[
0
]
+=
' AND '
+
quoteIdentifiedDeletedAtCol
+
' IS NULL '
}
else
{
}
else
{
options
.
where
[
deletedAtCol
]
=
null
options
.
where
[
deletedAtCol
]
=
null
}
}
...
...
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