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 edeff6e7
authored
Dec 30, 2013
by
Simon Townsend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using node url lib for parsing
1 parent
8c1ac604
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
bin/sequelize
package.json
bin/sequelize
View file @
edeff6e
...
@@ -6,7 +6,7 @@ var path = require("path")
...
@@ -6,7 +6,7 @@ var path = require("path")
,
Sequelize
=
require
(
__dirname
+
'/../index'
)
,
Sequelize
=
require
(
__dirname
+
'/../index'
)
,
moment
=
require
(
"moment"
)
,
moment
=
require
(
"moment"
)
,
_
=
Sequelize
.
Utils
.
_
,
_
=
Sequelize
.
Utils
.
_
,
parseDatabaseUrl
=
require
(
'parse-database-url'
)
,
url
=
require
(
"url"
)
var
configuration
=
{
var
configuration
=
{
configFile
:
process
.
cwd
()
+
'/config/config.json'
,
configFile
:
process
.
cwd
()
+
'/config/config.json'
,
...
@@ -87,20 +87,20 @@ var createMigrationsFolder = function(force) {
...
@@ -87,20 +87,20 @@ var createMigrationsFolder = function(force) {
}
}
}
}
var
parseDbUrl
=
function
(
url
)
{
var
parseDbUrl
=
function
(
url
String
)
{
var
parsed
,
var
parsed
,
config
;
config
=
{}
;
try
{
try
{
parsed
=
parseDatabaseUrl
(
url
);
urlParts
=
url
.
parse
(
urlString
)
//var dialect = parsed.driver == 'postgrest' ? 'pg' : parsed.driver
;
config
.
database
=
urlParts
.
path
.
replace
(
/^
\/
/
,
''
)
;
config
.
dialect
=
urlParts
.
protocol
;
config
=
{
config
.
dialect
=
config
.
dialect
.
replace
(
/:$/
,
''
);
username
:
parsed
.
user
||
null
,
config
.
host
=
urlParts
.
hostname
;
password
:
parsed
.
password
||
null
,
config
.
port
=
urlParts
.
port
;
database
:
parsed
.
database
||
null
,
host
:
parsed
.
host
||
null
,
if
(
urlParts
.
auth
)
{
port
:
parsed
.
port
||
null
,
config
.
username
=
urlParts
.
auth
.
split
(
':'
)[
0
]
dialect
:
parsed
.
driver
||
null
config
.
password
=
urlParts
.
auth
.
split
(
':'
)[
1
]
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
throw
new
Error
(
'Error parsing url: '
+
url
);
throw
new
Error
(
'Error parsing url: '
+
url
);
...
...
package.json
View file @
edeff6e
...
@@ -48,8 +48,7 @@
...
@@ -48,8 +48,7 @@
"sql"
:
"~0.31.0"
,
"sql"
:
"~0.31.0"
,
"circular-json"
:
"~0.1.5"
,
"circular-json"
:
"~0.1.5"
,
"bluebird"
:
"~0.11.5"
,
"bluebird"
:
"~0.11.5"
,
"node-uuid"
:
"~1.4.1"
,
"node-uuid"
:
"~1.4.1"
"parse-database-url"
:
"~0.2.0"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"sqlite3"
:
"~2.1.12"
,
"sqlite3"
:
"~2.1.12"
,
...
...
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