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 5611a26c
authored
Jul 21, 2017
by
Even
Committed by
Felix Becker
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(queryinterface): decrement regression (#7960)
Closes #7810
1 parent
cebc3af8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
lib/query-interface.js
test/integration/instance.test.js
lib/query-interface.js
View file @
5611a26
...
@@ -685,13 +685,14 @@ class QueryInterface {
...
@@ -685,13 +685,14 @@ class QueryInterface {
return
this
.
sequelize
.
query
(
sql
,
options
);
return
this
.
sequelize
.
query
(
sql
,
options
);
}
}
decrement
(
instance
,
tableName
,
values
,
identifier
,
options
)
{
decrement
(
model
,
tableName
,
values
,
identifier
,
options
)
{
const
sql
=
this
.
QueryGenerator
.
arithmeticQuery
(
'-'
,
tableName
,
values
,
identifier
,
options
,
options
.
attribute
s
);
options
=
Utils
.
cloneDeep
(
option
s
);
options
=
_
.
clone
(
options
)
||
{}
;
const
sql
=
this
.
QueryGenerator
.
arithmeticQuery
(
'-'
,
tableName
,
values
,
identifier
,
options
,
options
.
attributes
)
;
options
.
type
=
QueryTypes
.
UPDATE
;
options
.
type
=
QueryTypes
.
UPDATE
;
options
.
instance
=
instance
;
options
.
model
=
model
;
return
this
.
sequelize
.
query
(
sql
,
options
);
return
this
.
sequelize
.
query
(
sql
,
options
);
}
}
...
...
test/integration/instance.test.js
View file @
5611a26
...
@@ -310,6 +310,16 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
...
@@ -310,6 +310,16 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
});
});
}
}
if
(
current
.
dialect
.
supports
.
returnValues
.
returning
)
{
it
(
'supports returning'
,
function
()
{
return
this
.
User
.
findById
(
1
).
then
(
user1
=>
{
return
user1
.
decrement
(
'aNumber'
,
{
by
:
2
}).
then
(()
=>
{
expect
(
user1
.
aNumber
).
to
.
be
.
equal
(
-
2
);
});
});
});
}
it
(
'with array'
,
function
()
{
it
(
'with array'
,
function
()
{
const
self
=
this
;
const
self
=
this
;
return
this
.
User
.
findById
(
1
).
then
(
user1
=>
{
return
this
.
User
.
findById
(
1
).
then
(
user1
=>
{
...
...
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