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 8c482bfe
authored
Dec 04, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(include/schema): unable to reproduce #2385, closing #2385
1 parent
408d54ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
2 deletions
test/include/schema.test.js
test/include/schema.test.js
View file @
8c482bf
...
@@ -1511,5 +1511,81 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
...
@@ -1511,5 +1511,81 @@ describe(Support.getTestDialectTeaser("Includes with schemas"), function () {
})
})
})
})
})
});
})
describe
(
'findOne'
,
function
()
{
it
(
'should work with schemas'
,
function
()
{
var
self
=
this
;
var
UserModel
=
this
.
sequelize
.
define
(
'User'
,
{
Id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
},
Name
:
DataTypes
.
STRING
,
UserType
:
DataTypes
.
INTEGER
,
Email
:
DataTypes
.
STRING
,
PasswordHash
:
DataTypes
.
STRING
,
Enabled
:
{
type
:
DataTypes
.
BOOLEAN
},
CreatedDatetime
:
DataTypes
.
DATE
,
UpdatedDatetime
:
DataTypes
.
DATE
},
{
schema
:
'hero'
,
tableName
:
'User'
,
timestamps
:
false
});
var
ResumeModel
=
this
.
sequelize
.
define
(
'Resume'
,
{
Id
:
{
type
:
Sequelize
.
INTEGER
,
primaryKey
:
true
},
UserId
:
{
type
:
Sequelize
.
INTEGER
,
references
:
UserModel
,
referencesKey
:
"Id"
},
Name
:
Sequelize
.
STRING
,
Contact
:
Sequelize
.
STRING
,
School
:
Sequelize
.
STRING
,
WorkingAge
:
Sequelize
.
STRING
,
Description
:
Sequelize
.
STRING
,
PostType
:
Sequelize
.
INTEGER
,
RefreshDatetime
:
Sequelize
.
DATE
,
CreatedDatetime
:
Sequelize
.
DATE
},
{
schema
:
'hero'
,
tableName
:
'resume'
,
timestamps
:
false
});
UserModel
.
hasOne
(
ResumeModel
,
{
foreignKey
:
'UserId'
,
as
:
'Resume'
});
ResumeModel
.
belongsTo
(
UserModel
,
{
foreignKey
:
'UserId'
});
return
self
.
sequelize
.
dropAllSchemas
().
then
(
function
()
{
return
self
.
sequelize
.
createSchema
(
"hero"
);
}).
then
(
function
()
{
return
self
.
sequelize
.
sync
({
force
:
true
}).
then
(
function
()
{
return
UserModel
.
find
({
where
:
{
Id
:
1
},
include
:
[{
model
:
ResumeModel
,
as
:
'Resume'
}]
}).
on
(
'sql'
,
function
(
sql
)
{
console
.
log
(
sql
);
});
});
});
});
});
});
\ No newline at end of file
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