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 51a1b08d
authored
Jul 28, 2014
by
Ryan Pon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better fix for paranoidClause failing complex wheres
1 parent
8683d792
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
lib/model.js
test/dao-factory.test.js
lib/model.js
View file @
51a1b08
...
@@ -1584,9 +1584,11 @@ module.exports = (function() {
...
@@ -1584,9 +1584,11 @@ module.exports = (function() {
// of string-likes/Dates or an array with objects, hashes, or other
// of string-likes/Dates or an array with objects, hashes, or other
// complex data types
// complex data types
if
(
Utils
.
canTreatArrayAsAnd
(
options
.
where
))
{
if
(
Utils
.
canTreatArrayAsAnd
(
options
.
where
))
{
// TODO: This is simplifying this case greatly. We actually need all
// smth, tableName, factory, options, prepend
// the logic from QueryGenerator.getWhereConditions in order to
var
whereClause
=
this
.
QueryGenerator
.
getWhereConditions
(
options
.
where
,
this
.
getTableName
(),
this
,
options
);
// properly decide what to do here.
if
(
whereClause
.
indexOf
(
deletedAtCol
)
!==
-
1
)
{
return
options
;
}
var
whereObj
=
{};
var
whereObj
=
{};
whereObj
[
quoteIdentifiedDeletedAtCol
]
=
null
;
whereObj
[
quoteIdentifiedDeletedAtCol
]
=
null
;
options
.
where
.
push
(
whereObj
);
options
.
where
.
push
(
whereObj
);
...
...
test/dao-factory.test.js
View file @
51a1b08
...
@@ -2159,6 +2159,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -2159,6 +2159,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}).
error
(
done
)
}).
error
(
done
)
})
})
it
.
only
(
'should not overwrite a specified deletedAt (complex query)'
,
function
(
done
)
{
this
.
User
.
findAll
({
where
:
[
this
.
sequelize
.
or
({
username
:
'leia'
},
{
username
:
'luke'
}),
this
.
sequelize
.
and
(
{
id
:
[
1
,
2
,
3
]
},
this
.
sequelize
.
or
({
deletedAt
:
null
},
{
deletedAt
:
{
gt
:
new
Date
(
0
)
}
})
)
]
})
.
then
(
function
(
res
)
{
expect
(
res
).
to
.
have
.
length
(
2
)
done
()
})
.
catch
(
function
(
e
)
{
done
(
e
)
})
})
})
})
if
(
dialect
!==
'sqlite'
)
{
if
(
dialect
!==
'sqlite'
)
{
...
...
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