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 5817c532
authored
Aug 24, 2010
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added error handling to examples
1 parent
90bfe09b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
examples/MethodPassing/app.js
examples/UsingMultipleModelFiles/app.js
examples/MethodPassing/app.js
View file @
5817c53
...
...
@@ -27,18 +27,22 @@ var Task = sequelize.define("Task", {
// instance creation
var
task1
=
new
Task
({
name
:
'Choose a nice MySQL connector'
,
deadline
:
new
Date
(
Date
.
parse
(
"Jul 8, 2100"
)),
importance
:
10
})
var
task2
=
new
Task
({
name
:
'Build the rest'
,
deadline
:
new
Date
(
Date
.
parse
(
"Jul 8, 2005"
)),
importance
:
90
})
name
:
'Choose a nice MySQL connector'
,
deadline
:
new
Date
(
Date
.
parse
(
"Jul 8, 2100"
)),
importance
:
10
}),
task2
=
new
Task
({
name
:
'Build the rest'
,
deadline
:
new
Date
(
Date
.
parse
(
"Jul 8, 2005"
)),
importance
:
90
})
Task
.
drop
(
function
(
table
,
error
)
{
if
(
error
)
return
Sequelize
.
Helper
.
log
(
error
)
Task
.
drop
(
function
()
{
Task
.
sync
(
function
()
{
Task
.
sync
(
function
(
table
,
error
)
{
if
(
error
)
return
Sequelize
.
Helper
.
log
(
error
)
task1
.
save
(
function
()
{
task2
.
save
(
function
()
{
...
...
examples/UsingMultipleModelFiles/app.js
View file @
5817c53
...
...
@@ -6,8 +6,12 @@ var Sequelize = require(__dirname + "/../../src/Sequelize").Sequelize,
Project
.
hasMany
(
'tasks'
,
Task
)
Task
.
belongsTo
(
'project'
,
Project
)
sequelize
.
drop
(
function
()
{
sequelize
.
sync
(
function
()
{
sequelize
.
drop
(
function
(
errors
)
{
if
(
errors
.
length
>
0
)
return
Sequelize
.
Helper
.
log
(
errors
)
sequelize
.
sync
(
function
(
errors
)
{
if
(
errors
.
length
>
0
)
return
Sequelize
.
Helper
.
log
(
errors
)
new
Project
({
name
:
'Sequelize'
,
description
:
'A nice MySQL ORM for NodeJS'
...
...
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