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 234c3d60
authored
Jul 23, 2013
by
Daniel Durante
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed up MySQL dialect.
1 parent
cf2581ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
spec/associations/has-many.spec.js
spec/dao-factory.spec.js
spec/associations/has-many.spec.js
View file @
234c3d6
...
@@ -289,7 +289,9 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
...
@@ -289,7 +289,9 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
Parent
.
hasMany
(
Child
,
{
as
:
'Children'
,
foreignKey
:
'child_id'
,
joinTableName
:
'ParentRelationship'
})
Parent
.
hasMany
(
Child
,
{
as
:
'Children'
,
foreignKey
:
'child_id'
,
joinTableName
:
'ParentRelationship'
})
Child
.
hasMany
(
Parent
,
{
as
:
'Parents'
,
foreignKey
:
'parent_id'
,
joinTableName
:
'ParentRelationship'
})
Child
.
hasMany
(
Parent
,
{
as
:
'Parents'
,
foreignKey
:
'parent_id'
,
joinTableName
:
'ParentRelationship'
})
this
.
sequelize
.
sync
({
force
:
true
}).
success
(
function
()
{
ParentJoin
.
sync
({
force
:
true
}).
success
(
function
()
{
Parent
.
sync
({
force
:
true
}).
success
(
function
()
{
Child
.
sync
({
force
:
true
}).
success
(
function
()
{
Parent
.
create
({
name
:
'mom'
}).
success
(
function
(
mom
)
{
Parent
.
create
({
name
:
'mom'
}).
success
(
function
(
mom
)
{
parents
.
push
(
mom
)
parents
.
push
(
mom
)
Parent
.
create
({
name
:
'dad'
}).
success
(
function
(
dad
)
{
Parent
.
create
({
name
:
'dad'
}).
success
(
function
(
dad
)
{
...
@@ -310,6 +312,8 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
...
@@ -310,6 +312,8 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
})
})
})
})
})
})
})
})
it
(
"allows join table to be mapped and specified"
,
function
(
done
)
{
it
(
"allows join table to be mapped and specified"
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
name
:
Helpers
.
Sequelize
.
STRING
},
{
underscore
:
true
,
freezeTableName
:
true
})
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
name
:
Helpers
.
Sequelize
.
STRING
},
{
underscore
:
true
,
freezeTableName
:
true
})
...
...
spec/dao-factory.spec.js
View file @
234c3d6
...
@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
...
@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
})
})
describe
(
'use of invalid table name'
,
function
()
{
describe
(
'use of invalid table name'
,
function
()
{
before
(
function
(
done
)
{
it
(
"emits the error event as the referenced table name is invalid"
,
function
(
done
)
{
this
.
Post
=
this
.
sequelize
.
define
(
'post'
,
{
this
.
timeout
=
3500
var
self
=
this
self
.
Post
=
self
.
sequelize
.
define
(
'post'
,
{
title
:
Sequelize
.
STRING
,
title
:
Sequelize
.
STRING
,
authorId
:
{
authorId
:
{
type
:
Sequelize
.
INTEGER
,
type
:
Sequelize
.
INTEGER
,
...
@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
...
@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
}
}
})
})
this
.
Author
.
hasMany
(
this
.
Post
)
self
.
Author
.
hasMany
(
self
.
Post
)
this
.
Post
.
belongsTo
(
this
.
Author
)
self
.
Post
.
belongsTo
(
self
.
Author
)
done
()
})
it
(
"emits the error event as the referenced table name is invalid"
,
function
(
done
)
{
self
.
Author
.
sync
({
force
:
true
}).
success
(
function
()
{
this
.
timeout
=
2500
var
self
=
this
this
.
Author
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
Post
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
Post
.
sync
({
force
:
true
}).
success
(
function
()
{
if
(
dialect
===
'sqlite'
)
{
if
(
dialect
===
'sqlite'
)
{
// sorry ... but sqlite is too stupid to understand whats going on ...
// sorry ... but sqlite is too stupid to understand whats going on ...
...
...
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