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 4383922a
authored
Jul 20, 2017
by
Ali Taheri Moghaddar
Committed by
Felix Becker
Jul 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(dependency): Support pg version 7 (#7888)
1 parent
85ee83d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
18 deletions
docs/usage.md
lib/dialects/postgres/connection-manager.js
lib/dialects/postgres/query.js
docs/usage.md
View file @
4383922
...
...
@@ -201,7 +201,7 @@ const sequelize = new Sequelize('sqlite:relativePath/dbname.db')
### PostgreSQL
The library for PostgreSQL is
`pg@
~3.6
.0`
You'll just need to define the dialect:
The library for PostgreSQL is
`pg@
^5.0.0 || ^6.0.0 || ^7.0
.0`
You'll just need to define the dialect:
```
js
const
sequelize
=
new
Sequelize
(
'database'
,
'username'
,
'password'
,
{
...
...
lib/dialects/postgres/connection-manager.js
View file @
4383922
...
...
@@ -153,25 +153,22 @@ class ConnectionManager extends AbstractConnectionManager {
query
+=
'SELECT typname, oid, typarray FROM pg_type WHERE typtype = \'b\' AND typname IN (\'hstore\', \'geometry\', \'geography\')'
;
}
return
new
Promise
((
resolve
,
reject
)
=>
{
connection
.
query
(
query
)
.
on
(
'error'
,
err
=>
reject
(
err
))
.
on
(
'row'
,
row
=>
{
let
type
;
if
(
row
.
typname
===
'geometry'
)
{
type
=
dataTypes
.
postgres
.
GEOMETRY
;
}
else
if
(
row
.
typname
===
'hstore'
)
{
type
=
dataTypes
.
postgres
.
HSTORE
;
}
else
if
(
row
.
typname
===
'geography'
)
{
type
=
dataTypes
.
postgres
.
GEOGRAPHY
;
}
return
new
Promise
((
resolve
,
reject
)
=>
connection
.
query
(
query
,
(
error
,
result
)
=>
error
?
reject
(
error
)
:
resolve
(
result
))).
then
(
result
=>
{
for
(
const
row
of
result
.
rows
)
{
let
type
;
if
(
row
.
typname
===
'geometry'
)
{
type
=
dataTypes
.
postgres
.
GEOMETRY
;
}
else
if
(
row
.
typname
===
'hstore'
)
{
type
=
dataTypes
.
postgres
.
HSTORE
;
}
else
if
(
row
.
typname
===
'geography'
)
{
type
=
dataTypes
.
postgres
.
GEOGRAPHY
;
}
type
.
types
.
postgres
.
oids
.
push
(
row
.
oid
);
type
.
types
.
postgres
.
array_oids
.
push
(
row
.
typarray
);
type
.
types
.
postgres
.
oids
.
push
(
row
.
oid
);
type
.
types
.
postgres
.
array_oids
.
push
(
row
.
typarray
);
this
.
_refreshTypeParser
(
type
);
})
.
on
(
'end'
,
()
=>
resolve
());
this
.
_refreshTypeParser
(
type
);
}
});
});
}
...
...
lib/dialects/postgres/query.js
View file @
4383922
This diff is collapsed.
Click to expand it.
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