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 ba7aa331
authored
Sep 29, 2017
by
Gabe Gorelick
Committed by
Sushant
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(model): properly serialize WHERE attributes in soft delete (#8383)
1 parent
107502e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
lib/model.js
test/integration/instance.test.js
lib/model.js
View file @
ba7aa33
...
...
@@ -3788,7 +3788,7 @@ class Model {
this
.
setDataValue
(
field
,
values
[
field
]);
return
this
.
sequelize
.
getQueryInterface
().
update
(
this
,
this
.
constructor
.
getTableName
(
options
),
values
,
where
,
_
.
defaults
({
hooks
:
false
},
options
)
this
,
this
.
constructor
.
getTableName
(
options
),
values
,
where
,
_
.
defaults
({
hooks
:
false
,
model
:
this
.
constructor
},
options
)
).
then
(
results
=>
{
const
rowsUpdated
=
results
[
1
];
if
(
this
.
constructor
.
_versionAttribute
&&
rowsUpdated
<
1
)
{
...
...
test/integration/instance.test.js
View file @
ba7aa33
...
...
@@ -2100,6 +2100,32 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
});
});
});
if
(
dialect
.
match
(
/^postgres/
))
{
it
(
'converts Infinity in where clause to a timestamp'
,
function
()
{
const
Date
=
this
.
sequelize
.
define
(
'Date'
,
{
date
:
{
type
:
DataTypes
.
DATE
,
primaryKey
:
true
},
deletedAt
:
{
type
:
DataTypes
.
DATE
,
defaultValue
:
Infinity
}
},
{
paranoid
:
true
});
return
this
.
sequelize
.
sync
({
force
:
true
})
.
then
(()
=>
{
return
Date
.
build
({
date
:
Infinity
})
.
save
()
.
then
(
date
=>
{
return
date
.
destroy
();
});
});
});
}
});
describe
(
'isSoftDeleted'
,
()
=>
{
...
...
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