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 1c1aa330
authored
Jun 24, 2021
by
Pedro Augusto de Paula Barbosa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: nonempty array check style
1 parent
6dcb565e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
lib/dialects/abstract/query-interface.js
lib/model.js
lib/dialects/abstract/query-interface.js
View file @
1c1aa33
...
...
@@ -768,8 +768,8 @@ class QueryInterface {
const
model
=
options
.
model
;
const
primaryKeys
=
Object
.
values
(
model
.
primaryKeys
).
map
(
item
=>
item
.
field
);
const
uniqueKeys
=
Object
.
values
(
model
.
uniqueKeys
).
filter
(
c
=>
c
.
fields
.
length
>
=
1
).
map
(
c
=>
c
.
fields
);
const
indexKeys
=
Object
.
values
(
model
.
_indexes
).
filter
(
c
=>
c
.
unique
&&
c
.
fields
.
length
>
=
1
).
map
(
c
=>
c
.
fields
);
const
uniqueKeys
=
Object
.
values
(
model
.
uniqueKeys
).
filter
(
c
=>
c
.
fields
.
length
>
0
).
map
(
c
=>
c
.
fields
);
const
indexKeys
=
Object
.
values
(
model
.
_indexes
).
filter
(
c
=>
c
.
unique
&&
c
.
fields
.
length
>
0
).
map
(
c
=>
c
.
fields
);
options
.
type
=
QueryTypes
.
UPSERT
;
options
.
updateOnDuplicate
=
Object
.
keys
(
updateValues
);
...
...
lib/model.js
View file @
1c1aa33
...
...
@@ -2692,7 +2692,7 @@ class Model {
}
}
const
firstUniqueKey
=
Object
.
values
(
model
.
uniqueKeys
).
find
(
c
=>
c
.
fields
.
length
>
=
1
);
const
firstUniqueKey
=
Object
.
values
(
model
.
uniqueKeys
).
find
(
c
=>
c
.
fields
.
length
>
0
);
if
(
firstUniqueKey
&&
firstUniqueKey
.
fields
)
{
upsertKeys
.
push
(...
firstUniqueKey
.
fields
);
...
...
@@ -3848,10 +3848,10 @@ class Model {
const
now
=
Utils
.
now
(
this
.
sequelize
.
options
.
dialect
);
let
updatedAtAttr
=
this
.
constructor
.
_timestampAttributes
.
updatedAt
;
if
(
updatedAtAttr
&&
options
.
fields
.
length
>
=
1
&&
!
options
.
fields
.
includes
(
updatedAtAttr
))
{
if
(
updatedAtAttr
&&
options
.
fields
.
length
>
0
&&
!
options
.
fields
.
includes
(
updatedAtAttr
))
{
options
.
fields
.
push
(
updatedAtAttr
);
}
if
(
versionAttr
&&
options
.
fields
.
length
>
=
1
&&
!
options
.
fields
.
includes
(
versionAttr
))
{
if
(
versionAttr
&&
options
.
fields
.
length
>
0
&&
!
options
.
fields
.
includes
(
versionAttr
))
{
options
.
fields
.
push
(
versionAttr
);
}
...
...
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