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 a5b4c60a
authored
Jan 02, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix/bulkCreate] allow values to be passed for auto incremented columns, fixes #1186
1 parent
cd1b89a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
lib/dialects/postgres/query-generator.js
test/dao-factory/create.test.js
lib/dialects/postgres/query-generator.js
View file @
a5b4c60
...
@@ -311,7 +311,7 @@ module.exports = (function() {
...
@@ -311,7 +311,7 @@ module.exports = (function() {
tuples
.
push
(
"("
+
tuples
.
push
(
"("
+
Utils
.
_
.
map
(
attrValueHash
,
function
(
value
,
key
){
Utils
.
_
.
map
(
attrValueHash
,
function
(
value
,
key
){
if
(
serials
.
indexOf
(
key
)
!==
-
1
)
{
if
(
serials
.
indexOf
(
key
)
!==
-
1
)
{
return
'DEFAULT'
;
return
value
||
'DEFAULT'
;
}
}
return
this
.
escape
(
value
)
return
this
.
escape
(
value
)
}.
bind
(
this
)).
join
(
","
)
+
}.
bind
(
this
)).
join
(
","
)
+
...
...
test/dao-factory/create.test.js
View file @
a5b4c60
...
@@ -906,6 +906,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -906,6 +906,23 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
})
})
it
(
'should allow autoincremented attributes to be set'
,
function
(
done
)
{
var
Worker
=
this
.
sequelize
.
define
(
'Worker'
,
{},
{
timestamps
:
false
})
Worker
.
sync
().
done
(
function
(
err
)
{
Worker
.
bulkCreate
([
{
id
:
5
},
{
id
:
10
}
]).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
Worker
.
findAll
({
order
:
'id ASC'
}).
done
(
function
(
err
,
workers
)
{
expect
(
workers
[
0
].
id
).
to
.
equal
(
5
)
expect
(
workers
[
1
].
id
).
to
.
equal
(
10
)
done
()
})
})
})
})
describe
(
'enums'
,
function
()
{
describe
(
'enums'
,
function
()
{
it
(
'correctly restores enum values'
,
function
(
done
)
{
it
(
'correctly restores enum values'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
...
...
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