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 8085b6b1
authored
Jan 18, 2012
by
Meg Sharkey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing tests, WIP
1 parent
5703c754
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
21 deletions
lib/dialects/mysql/query-generator.js
lib/model-factory.js
spec/associations/has-many.spec.js
spec/mysql/associations.spec.js
lib/dialects/mysql/query-generator.js
View file @
8085b6b
...
...
@@ -241,7 +241,8 @@ module.exports = (function() {
hashToWhereConditions
:
function
(
hash
)
{
return
Utils
.
_
.
map
(
hash
,
function
(
value
,
key
)
{
var
_key
=
Utils
.
addTicks
(
key
)
//handle qualified key names
var
_key
=
key
.
split
(
'.'
).
map
(
function
(
col
){
return
Utils
.
addTicks
(
col
)}).
join
(
"."
)
,
_value
=
null
if
(
Array
.
isArray
(
value
))
{
...
...
lib/model-factory.js
View file @
8085b6b
...
...
@@ -95,8 +95,7 @@ module.exports = (function() {
optcpy
=
Utils
.
_
.
clone
(
options
)
optcpy
.
attributes
=
optcpy
.
attributes
||
[
Utils
.
addTicks
(
this
.
tableName
)
+
".*"
]
return
this
.
query
(
QueryGenerator
.
selectQuery
([
this
.
tableName
,
joinTableName
],
optcpy
))
return
this
.
QueryInterface
.
select
(
this
,
[
this
.
tableName
,
joinTableName
],
optcpy
)
}
ModelFactory
.
prototype
.
find
=
function
(
options
)
{
...
...
spec/associations/has-many.spec.js
View file @
8085b6b
...
...
@@ -95,22 +95,6 @@ describe('HasMany', function() {
})
describe
(
"when a join table name is specified"
,
function
()
{
var
Table2
=
sequelize
.
define
(
'ms_table1'
,
{
foo
:
Sequelize
.
STRING
})
,
Table1
=
sequelize
.
define
(
'ms_table2'
,
{
foo
:
Sequelize
.
STRING
})
Table1
.
hasMany
(
Table2
,
{
joinTableName
:
'table1_to_table2'
})
Table2
.
hasMany
(
Table1
,
{
joinTableName
:
'table1_to_table2'
})
it
(
"should not use a combined name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'ms_table1sms_table2s'
)).
toBeUndefined
()
})
it
(
"should use the specified name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'table1_to_table2'
)).
toBeDefined
()
})
})
describe
(
'bi-directional'
,
function
()
{
it
(
'adds the foreign key'
,
function
()
{
Task
.
hasMany
(
User
)
...
...
spec/mysql/associations.spec.js
View file @
8085b6b
...
...
@@ -32,10 +32,10 @@ describe('Associations', function() {
Table2
.
hasMany
(
Table1
,
{
joinTableName
:
'table1_to_table2'
})
it
(
"should not use a combined name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'ms_table1sms_table2s'
)).
toBeUndefined
()
expect
(
sequelize
.
model
Factory
Manager
.
getModel
(
'ms_table1sms_table2s'
)).
toBeUndefined
()
})
it
(
"should use the specified name"
,
function
()
{
expect
(
sequelize
.
modelManager
.
getModel
(
'table1_to_table2'
)).
toBeDefined
()
expect
(
sequelize
.
model
Factory
Manager
.
getModel
(
'table1_to_table2'
)).
toBeDefined
()
})
})
})
...
...
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