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 0fa7608a
authored
Dec 21, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored auto increment
1 parent
6436c021
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
lib/model-factory.js
lib/model-factory.js
View file @
0fa7608
...
@@ -110,7 +110,7 @@ module.exports = (function() {
...
@@ -110,7 +110,7 @@ module.exports = (function() {
// options is not a hash but an id
// options is not a hash but an id
if
(
typeof
options
==
'number'
)
if
(
typeof
options
==
'number'
)
options
=
{
where
:
options
}
options
=
{
where
:
options
}
else
if
(
Utils
.
argsArePrimaryKeys
(
arguments
,
this
.
primaryKeys
))
{
else
if
(
Utils
.
argsArePrimaryKeys
(
arguments
,
this
.
primaryKeys
))
{
var
where
=
{}
var
where
=
{}
,
self
=
this
,
self
=
this
...
@@ -120,7 +120,7 @@ module.exports = (function() {
...
@@ -120,7 +120,7 @@ module.exports = (function() {
where
[
key
]
=
arg
where
[
key
]
=
arg
})
})
options
=
{
where
:
where
}
options
=
{
where
:
where
}
}
}
options
.
limit
=
1
options
.
limit
=
1
...
@@ -228,16 +228,16 @@ module.exports = (function() {
...
@@ -228,16 +228,16 @@ module.exports = (function() {
}
}
var
findAutoIncrementField
=
function
()
{
var
findAutoIncrementField
=
function
()
{
var
self
=
this
var
self
=
this
,
fields
=
this
.
QueryGenerator
.
findAutoIncrementField
(
this
)
this
.
autoIncrementField
=
null
this
.
autoIncrementField
=
null
Utils
.
_
.
map
(
this
.
attributes
,
function
(
definition
,
name
)
{
if
(
definition
&&
(
definition
.
indexOf
(
'auto_increment'
)
>
-
1
))
{
fields
.
forEach
(
function
(
field
)
{
if
(
self
.
autoIncrementField
)
if
(
self
.
autoIncrementField
)
throw
new
Error
(
'Invalid model definition. Only one autoincrement field allowed.'
)
throw
new
Error
(
'Invalid model definition. Only one autoincrement field allowed.'
)
else
else
self
.
autoIncrementField
=
name
self
.
autoIncrementField
=
field
}
})
})
}
}
...
...
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