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 d44300d2
authored
Jun 20, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed isManyMany to useJunctionTable
1 parent
6e37a9f6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
lib/associations/has-many.js
spec-jasmine/associations/has-many.spec.js
lib/associations/has-many.js
View file @
d44300d
...
@@ -9,7 +9,7 @@ module.exports = (function() {
...
@@ -9,7 +9,7 @@ module.exports = (function() {
this
.
source
=
srcDAO
this
.
source
=
srcDAO
this
.
target
=
targetDAO
this
.
target
=
targetDAO
this
.
options
=
options
this
.
options
=
options
this
.
isManyMany
=
this
.
options
.
isManyMany
===
undefined
?
true
:
this
.
options
.
isManyMany
this
.
useJunctionTable
=
this
.
options
.
useJunctionTable
===
undefined
?
true
:
this
.
options
.
useJunctionTable
this
.
isSelfAssociation
=
(
this
.
source
.
tableName
==
this
.
target
.
tableName
)
this
.
isSelfAssociation
=
(
this
.
source
.
tableName
==
this
.
target
.
tableName
)
this
.
associationAccessor
=
this
.
combinedName
=
this
.
options
.
joinTableName
||
Utils
.
combineTableNames
(
this
.
associationAccessor
=
this
.
combinedName
=
this
.
options
.
joinTableName
||
Utils
.
combineTableNames
(
...
@@ -35,7 +35,7 @@ module.exports = (function() {
...
@@ -35,7 +35,7 @@ module.exports = (function() {
// is there already a single sided association between the source and the target?
// is there already a single sided association between the source and the target?
// or is the association on the model itself?
// or is the association on the model itself?
if
((
this
.
isSelfAssociation
&&
this
.
isManyMany
)
||
multiAssociation
)
{
if
((
this
.
isSelfAssociation
&&
this
.
useJunctionTable
)
||
multiAssociation
)
{
// remove the obsolete association identifier from the source
// remove the obsolete association identifier from the source
if
(
this
.
isSelfAssociation
)
{
if
(
this
.
isSelfAssociation
)
{
this
.
foreignIdentifier
=
Utils
.
_
.
underscoredIf
((
this
.
options
.
as
||
this
.
target
.
tableName
)
+
'Id'
,
this
.
options
.
underscored
)
this
.
foreignIdentifier
=
Utils
.
_
.
underscoredIf
((
this
.
options
.
as
||
this
.
target
.
tableName
)
+
'Id'
,
this
.
options
.
underscored
)
...
...
spec-jasmine/associations/has-many.spec.js
View file @
d44300d
...
@@ -98,7 +98,7 @@ describe('HasMany', function() {
...
@@ -98,7 +98,7 @@ describe('HasMany', function() {
var
Comment
=
sequelize
.
define
(
'Comment'
,
{
content
:
Sequelize
.
STRING
})
var
Comment
=
sequelize
.
define
(
'Comment'
,
{
content
:
Sequelize
.
STRING
})
Comment
.
belongsTo
(
Comment
,
{
as
:
"Parent"
});
Comment
.
belongsTo
(
Comment
,
{
as
:
"Parent"
});
Comment
.
hasMany
(
Comment
,
{
as
:
'Children'
,
foreignKey
:
"ParentId"
,
isManyMany
:
false
})
Comment
.
hasMany
(
Comment
,
{
as
:
'Children'
,
foreignKey
:
"ParentId"
,
useJunctionTable
:
false
})
expect
(
sequelize
.
daoFactoryManager
.
daos
.
length
).
toEqual
(
oldLength
+
1
)
expect
(
sequelize
.
daoFactoryManager
.
daos
.
length
).
toEqual
(
oldLength
+
1
)
...
...
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