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 5ac0d978
authored
Aug 11, 2016
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3' of github.com:sequelize/sequelize into v3
2 parents
0f8bf474
9bf902da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
lib/model.js
lib/model.js
View file @
5ac0d97
...
@@ -2083,6 +2083,9 @@ Model.prototype.bulkCreate = function(records, options) {
...
@@ -2083,6 +2083,9 @@ Model.prototype.bulkCreate = function(records, options) {
options
.
fields
=
options
.
fields
||
Object
.
keys
(
this
.
tableAttributes
);
options
.
fields
=
options
.
fields
||
Object
.
keys
(
this
.
tableAttributes
);
// Expose model to global hooks
options
.
model
=
this
;
var
dialect
=
this
.
sequelize
.
options
.
dialect
;
var
dialect
=
this
.
sequelize
.
options
.
dialect
;
if
(
options
.
ignoreDuplicates
&&
[
'postgres'
,
'mssql'
].
indexOf
(
dialect
)
!==
-
1
)
{
if
(
options
.
ignoreDuplicates
&&
[
'postgres'
,
'mssql'
].
indexOf
(
dialect
)
!==
-
1
)
{
return
Promise
.
reject
(
new
Error
(
dialect
+
' does not support the \'ignoreDuplicates\' option.'
));
return
Promise
.
reject
(
new
Error
(
dialect
+
' does not support the \'ignoreDuplicates\' option.'
));
...
@@ -2185,8 +2188,6 @@ Model.prototype.bulkCreate = function(records, options) {
...
@@ -2185,8 +2188,6 @@ Model.prototype.bulkCreate = function(records, options) {
}
}
}
}
// Insert all records at once
options
.
model
=
self
;
return
self
.
QueryInterface
.
bulkInsert
(
self
.
getTableName
(
options
),
records
,
options
,
attributes
).
then
(
function
(
results
)
{
return
self
.
QueryInterface
.
bulkInsert
(
self
.
getTableName
(
options
),
records
,
options
,
attributes
).
then
(
function
(
results
)
{
if
(
Array
.
isArray
(
results
))
{
if
(
Array
.
isArray
(
results
))
{
results
.
forEach
(
function
(
result
,
i
)
{
results
.
forEach
(
function
(
result
,
i
)
{
...
@@ -2342,6 +2343,9 @@ Model.prototype.restore = function(options) {
...
@@ -2342,6 +2343,9 @@ Model.prototype.restore = function(options) {
options
.
type
=
QueryTypes
.
RAW
;
options
.
type
=
QueryTypes
.
RAW
;
// Expose model to global hooks
options
.
model
=
this
;
var
self
=
this
var
self
=
this
,
instances
;
,
instances
;
...
@@ -2434,6 +2438,9 @@ Model.prototype.update = function(values, options) {
...
@@ -2434,6 +2438,9 @@ Model.prototype.update = function(values, options) {
options
.
type
=
QueryTypes
.
BULKUPDATE
;
options
.
type
=
QueryTypes
.
BULKUPDATE
;
// Expose model to global hooks
options
.
model
=
this
;
this
.
$injectScope
(
options
);
this
.
$injectScope
(
options
);
// Clone values so it doesn't get modified for caller scope
// Clone values so it doesn't get modified for caller scope
...
...
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