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 0457a47e
authored
May 09, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
binary can now create migration skeletons
1 parent
e8bc41a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
bin/sequelize
changelog.md
bin/sequelize
View file @
0457a47
...
@@ -4,6 +4,7 @@ const path = require("path")
...
@@ -4,6 +4,7 @@ const path = require("path")
,
fs
=
require
(
"fs"
)
,
fs
=
require
(
"fs"
)
,
program
=
require
(
"commander"
)
,
program
=
require
(
"commander"
)
,
Sequelize
=
require
(
__dirname
+
'/../index'
)
,
Sequelize
=
require
(
__dirname
+
'/../index'
)
,
moment
=
require
(
"moment"
)
,
_
=
Sequelize
.
Utils
.
_
,
_
=
Sequelize
.
Utils
.
_
var
configPath
=
process
.
cwd
()
+
'/config'
var
configPath
=
process
.
cwd
()
+
'/config'
...
@@ -60,6 +61,7 @@ program
...
@@ -60,6 +61,7 @@ program
.
option
(
'-m, --migrate'
,
'Runs undone migrations'
)
.
option
(
'-m, --migrate'
,
'Runs undone migrations'
)
.
option
(
'-u, --undo'
,
'Redo the last migration.'
)
.
option
(
'-u, --undo'
,
'Redo the last migration.'
)
.
option
(
'-f, --force'
,
'Forces the action to be done.'
)
.
option
(
'-f, --force'
,
'Forces the action to be done.'
)
.
option
(
'-c, --create-migration [migration-name]'
,
'Create a new migration skeleton file.'
)
.
parse
(
process
.
argv
)
.
parse
(
process
.
argv
)
if
(
program
.
migrate
)
{
if
(
program
.
migrate
)
{
...
@@ -110,6 +112,26 @@ if(program.migrate) {
...
@@ -110,6 +112,26 @@ if(program.migrate) {
}
}
createMigrationsFolder
(
program
.
force
)
createMigrationsFolder
(
program
.
force
)
}
else
if
(
program
.
createMigration
)
{
createMigrationsFolder
()
var
migrationName
=
[
moment
().
format
(
'YYYYMMDDHHmmss'
),
(
typeof
program
.
createMigration
==
'string'
)
?
program
.
createMigration
:
'unnamed-migration'
].
join
(
'-'
)
+
'.js'
var
migrationContent
=
[
"module.exports = {"
,
" up: function(migration, DataTypes) {"
,
" // add altering commands here"
,
" },"
,
" down: function(migration) {"
,
" // add reverting commands here"
,
" }"
,
"}"
].
join
(
'\n'
)
fs
.
writeFileSync
(
migrationsPath
+
'/'
+
migrationName
,
migrationContent
)
}
else
{
}
else
{
console
.
log
(
'Please define any params!'
)
console
.
log
(
'Please define any params!'
)
}
}
changelog.md
View file @
0457a47
# v1.4.1 #
# v1.4.1 #
-
[
DEPRECATION
]
Added deprecation warning for node < v0.6.
-
[
DEPRECATION
]
Added deprecation warning for node < v0.6.
-
[
FEATURE
]
added selective saving of instances (thanks to kioopi)
-
[
FEATURE
]
added selective saving of instances (thanks to kioopi)
-
[
FEATURE
]
added command to binary for creating a migration skeleton with current timestamp
# v1.4.0 #
# v1.4.0 #
-
[
BUG
]
fixed booleans in sqlite (thanks to alexstrat)
-
[
BUG
]
fixed booleans in sqlite (thanks to alexstrat)
...
...
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