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 809ad7cf
authored
Feb 07, 2014
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move checker logic into separate function
1 parent
ae40ce9e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
bin/sequelize
bin/sequelize
View file @
809ad7c
...
@@ -169,6 +169,17 @@ if(typeof program.env === 'string') {
...
@@ -169,6 +169,17 @@ if(typeof program.env === 'string') {
configuration
.
environment
=
program
.
env
configuration
.
environment
=
program
.
env
}
}
var
supportCoffeeScript
=
function
()
{
try
{
config
=
readConfig
()
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
process
.
exit
(
1
)
}
return
program
.
coffee
||
config
.
coffee
}
if
(
program
.
migrate
||
program
.
undo
)
{
if
(
program
.
migrate
||
program
.
undo
)
{
if
(
configFileExists
()
||
program
.
url
)
{
if
(
configFileExists
()
||
program
.
url
)
{
var
config
var
config
...
@@ -209,7 +220,7 @@ if (program.migrate || program.undo) {
...
@@ -209,7 +220,7 @@ if (program.migrate || program.undo) {
var
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
options
)
var
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
options
)
,
migratorOptions
=
{
path
:
configuration
.
migrationsPath
}
,
migratorOptions
=
{
path
:
configuration
.
migrationsPath
}
if
(
program
.
coffee
||
config
.
coffee
)
{
if
(
supportCoffeeScript
()
)
{
migratorOptions
=
_
.
merge
(
migratorOptions
,
{
filesFilter
:
/
\.
js$|
\.
coffee$/
})
migratorOptions
=
_
.
merge
(
migratorOptions
,
{
filesFilter
:
/
\.
js$|
\.
coffee$/
})
}
}
...
@@ -252,21 +263,14 @@ if (program.migrate || program.undo) {
...
@@ -252,21 +263,14 @@ if (program.migrate || program.undo) {
}
else
if
(
program
.
createMigration
)
{
}
else
if
(
program
.
createMigration
)
{
createMigrationsFolder
()
createMigrationsFolder
()
try
{
var
config
=
readConfig
()
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
process
.
exit
(
1
)
}
var
mirationContent
=
""
var
mirationContent
=
""
,
migrationExtension
=
(
program
.
coffee
||
config
.
coffee
)
?
'.coffee'
:
'.js'
,
migrationExtension
=
(
supportCoffeeScript
()
)
?
'.coffee'
:
'.js'
,
migrationName
=
[
,
migrationName
=
[
moment
().
format
(
'YYYYMMDDHHmmss'
),
moment
().
format
(
'YYYYMMDDHHmmss'
),
(
typeof
program
.
createMigration
===
'string'
)
?
program
.
createMigration
:
'unnamed-migration'
(
typeof
program
.
createMigration
===
'string'
)
?
program
.
createMigration
:
'unnamed-migration'
].
join
(
'-'
)
+
migrationExtension
].
join
(
'-'
)
+
migrationExtension
if
(
program
.
coffee
||
config
.
coffee
)
{
if
(
supportCoffeeScript
()
)
{
migrationContent
=
[
migrationContent
=
[
"module.exports = "
,
"module.exports = "
,
" up: (migration, DataTypes, done) ->"
,
" up: (migration, DataTypes, done) ->"
,
...
...
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