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 bce34621
authored
Apr 15, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1632 from sangpire/master
Support postgreSQL '
postgresql://'
scheme.
2 parents
ea399fca
f3efb307
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
lib/sequelize.js
test/sequelize.test.js
lib/sequelize.js
View file @
bce3462
...
@@ -97,6 +97,10 @@ module.exports = (function() {
...
@@ -97,6 +97,10 @@ module.exports = (function() {
language
:
'en'
language
:
'en'
},
options
||
{})
},
options
||
{})
if
(
this
.
options
.
dialect
===
'postgresql'
)
{
this
.
options
.
dialect
=
'postgres'
}
if
(
this
.
options
.
logging
===
true
)
{
if
(
this
.
options
.
logging
===
true
)
{
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
this
.
options
.
logging
=
console
.
log
this
.
options
.
logging
=
console
.
log
...
...
test/sequelize.test.js
View file @
bce3462
...
@@ -52,6 +52,18 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
...
@@ -52,6 +52,18 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
var
sequelize
=
new
Sequelize
(
'sqlite://test.sqlite/lol?reconnect=true'
)
var
sequelize
=
new
Sequelize
(
'sqlite://test.sqlite/lol?reconnect=true'
)
})
})
}
}
if
(
dialect
===
'postgres'
)
{
var
getConnectionUri
=
_
.
template
(
'<%= protocol %>://<%= username %>:<%= password %>@<%= host %><% if(port) { %>:<%= port %><% } %>/<%= database %>'
)
it
(
'should work with connection strings (postgres protocol)'
,
function
()
{
var
connectionUri
=
getConnectionUri
(
_
.
extend
(
config
[
dialect
],
{
protocol
:
'postgres'
}))
var
sequelize
=
new
Sequelize
(
connectionUri
)
// postgres://...
})
it
(
'should work with connection strings (postgresql protocol)'
,
function
()
{
var
connectionUri
=
getConnectionUri
(
_
.
extend
(
config
[
dialect
],
{
protocol
:
'postgresql'
}))
var
sequelize
=
new
Sequelize
(
connectionUri
)
// postgresql://...
})
}
})
})
if
(
dialect
!==
'sqlite'
)
{
if
(
dialect
!==
'sqlite'
)
{
...
...
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