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 9e709cee
authored
Jan 29, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly set default port
1 parent
304fab8a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
lib/dialects/postgres/connector-manager.js
lib/sequelize.js
test/configuration.test.js
lib/dialects/postgres/connector-manager.js
View file @
9e709ce
...
@@ -13,7 +13,6 @@ module.exports = (function() {
...
@@ -13,7 +13,6 @@ module.exports = (function() {
this
.
pooling
=
(
!!
this
.
config
.
pool
&&
(
this
.
config
.
pool
.
maxConnections
>
0
))
this
.
pooling
=
(
!!
this
.
config
.
pool
&&
(
this
.
config
.
pool
.
maxConnections
>
0
))
this
.
pg
=
this
.
config
.
native
?
require
(
pgModule
).
native
:
require
(
pgModule
)
this
.
pg
=
this
.
config
.
native
?
require
(
pgModule
).
native
:
require
(
pgModule
)
this
.
poolIdentifier
=
null
this
.
poolIdentifier
=
null
// Better support for BigInts
// Better support for BigInts
// https://github.com/brianc/node-postgres/issues/166#issuecomment-9514935
// https://github.com/brianc/node-postgres/issues/166#issuecomment-9514935
this
.
pg
.
types
.
setTypeParser
(
20
,
String
);
this
.
pg
.
types
.
setTypeParser
(
20
,
String
);
...
...
lib/sequelize.js
View file @
9e709ce
...
@@ -20,7 +20,7 @@ module.exports = (function() {
...
@@ -20,7 +20,7 @@ module.exports = (function() {
@param {String} [options.dialect='mysql'] The dialect of the relational database.
@param {String} [options.dialect='mysql'] The dialect of the relational database.
@param {String} [options.dialectModulePath=null] If specified, load the dialect library from this path.
@param {String} [options.dialectModulePath=null] If specified, load the dialect library from this path.
@param {String} [options.host='localhost'] The host of the relational database.
@param {String} [options.host='localhost'] The host of the relational database.
@param {Integer} [options.port=
3306
] The port of the relational database.
@param {Integer} [options.port=] The port of the relational database.
@param {String} [options.protocol='tcp'] The protocol of the relational database.
@param {String} [options.protocol='tcp'] The protocol of the relational database.
@param {Object} [options.define={}] Options, which shall be default for every model definition.
@param {Object} [options.define={}] Options, which shall be default for every model definition.
@param {Object} [options.query={}] I have absolutely no idea.
@param {Object} [options.query={}] I have absolutely no idea.
...
@@ -75,7 +75,6 @@ module.exports = (function() {
...
@@ -75,7 +75,6 @@ module.exports = (function() {
dialect
:
'mysql'
,
dialect
:
'mysql'
,
dialectModulePath
:
null
,
dialectModulePath
:
null
,
host
:
'localhost'
,
host
:
'localhost'
,
port
:
3306
,
protocol
:
'tcp'
,
protocol
:
'tcp'
,
define
:
{},
define
:
{},
query
:
{},
query
:
{},
...
...
test/configuration.test.js
View file @
9e709ce
...
@@ -70,13 +70,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
...
@@ -70,13 +70,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
done
()
done
()
})
})
it
(
'should use the default port when no other is specified'
,
function
(
done
)
{
it
(
'should use the default port when no other is specified'
,
function
()
{
var
sequelize
=
new
Sequelize
(
'mysql://example.com/dbname'
)
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
,
'pass'
,
{
var
config
=
sequelize
.
config
dialect
:
dialect
})
,
config
=
sequelize
.
connectorManager
.
config
,
port
if
(
Support
.
dialectIsMySQL
())
{
port
=
3306
}
else
if
(
dialect
===
"postgres"
||
dialect
===
"postgres-native"
)
{
port
=
5432
}
else
{
// sqlite has no concept of ports when connecting
return
}
// The default port should be set
expect
(
config
.
port
).
to
.
equal
(
port
)
expect
(
config
.
port
).
to
.
equal
(
3306
)
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