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 b8e584d7
authored
Oct 21, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added config for production/development/test and use development config by default
1 parent
9f1eacd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
bin/sequelize
bin/sequelize
View file @
b8e584d
...
@@ -52,9 +52,12 @@ var createMigrationsFolder = function(force) {
...
@@ -52,9 +52,12 @@ var createMigrationsFolder = function(force) {
var
readConfig
=
function
()
{
var
readConfig
=
function
()
{
try
{
try
{
var
config
=
JSON
.
parse
(
fs
.
readFileSync
(
configFile
))
var
config
=
JSON
.
parse
(
fs
.
readFileSync
(
configFile
))
if
(
config
[
process
.
env
.
NODE_ENV
])
{
,
env
=
process
.
env
.
NODE_ENV
||
'development'
config
=
config
[
process
.
env
.
NODE_ENV
]
if
(
config
[
env
])
{
config
=
config
[
env
]
}
}
return
config
return
config
}
catch
(
e
)
{
}
catch
(
e
)
{
throw
new
Error
(
'The config.json is not available or contains invalid JSON.'
)
throw
new
Error
(
'The config.json is not available or contains invalid JSON.'
)
...
@@ -106,14 +109,22 @@ if(program.migrate) {
...
@@ -106,14 +109,22 @@ if(program.migrate) {
}
else
if
(
program
.
init
)
{
}
else
if
(
program
.
init
)
{
if
(
!
configFileExists
||
!!
program
.
force
)
{
if
(
!
configFileExists
||
!!
program
.
force
)
{
writeConfig
({
writeConfig
({
development
:
{
username
:
"root"
,
username
:
"root"
,
password
:
null
,
password
:
null
,
database
:
'database'
,
database
:
'database_development'
,
host
:
'127.0.0.1'
,
host
:
'127.0.0.1'
development
:
{
},
test
:
{
username
:
"root"
,
password
:
null
,
database
:
'database_test'
,
host
:
'127.0.0.1'
},
production
:
{
username
:
"root"
,
username
:
"root"
,
password
:
null
,
password
:
null
,
database
:
'database'
,
database
:
'database
_production
'
,
host
:
'127.0.0.1'
host
:
'127.0.0.1'
}
}
})
})
...
...
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