File tree Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Original file line number Diff line number Diff line change
1
+ ## 3.0.0
2
+
3
+ Thanks to @billwashere , we upgraded to a more modern version of ` pg ` (4.5.1 ->
4
+ 7.4.1), which means that the way the database information is provided has
5
+ changed. Previously, you could pass a URL to sharedb-postgres, like:
6
+
7
+ ``` js
8
+ const db = require (' sharedb-postgres' )(' postgres://localhost/mydb' );
9
+ ```
10
+
11
+ This is no longer supported, and you must instead pass a config object:
12
+
13
+ ``` js
14
+ const db = require (' sharedb-postgres' )({host: ' localhost' , database: ' mydb' });
15
+ ```
16
+
17
+ See the [ node-postgres] ( https://node-postgres.com/features/connecting )
18
+ documentation for more details about what can be passed in the config object.
19
+ Additionally, if no object is provided, ` pg ` will use the same environment
20
+ variables as ` libpq ` (` PGUSER ` , ` PGHOST ` and so on).
Original file line number Diff line number Diff line change @@ -51,16 +51,15 @@ PGUSER=dbuser PGPASSWORD=secretpassword PGHOST=database.server.com PGDATABASE=m
51
51
Example using an object
52
52
53
53
``` js
54
- var db = require (' sharedb-postgres' )({
55
- user: ' dbuser' ,
56
- host: ' database.server.com' ,
57
- database: ' mydb' ,
58
- password: ' secretpassword' ,
59
- port: 5433 ,
60
- });
54
+ var db = require (' sharedb-postgres' )({host: ' localhost' , database: ' mydb' });
61
55
var backend = require (' sharedb' )({db: db})
62
56
```
63
57
64
58
## Error codes
65
59
66
60
PostgreSQL errors are passed back directly.
61
+
62
+ ## Changelog
63
+
64
+ Note that version 3.0.0 introduces breaking changes in how you specify
65
+ connection parameters. See the [ changelog] ( CHANGELOG.md ) for more info.
Original file line number Diff line number Diff line change @@ -9,17 +9,15 @@ function PostgresDB(options) {
9
9
10
10
this . closed = false ;
11
11
12
- this . pg_config = options ;
13
- this . pool = new pg . Pool ( this . pg_config )
14
-
12
+ this . pool = new pg . Pool ( options ) ;
15
13
} ;
16
14
module . exports = PostgresDB ;
17
15
18
16
PostgresDB . prototype = Object . create ( DB . prototype ) ;
19
17
20
18
PostgresDB . prototype . close = function ( callback ) {
21
19
this . closed = true ;
22
- this . pool . end ( )
20
+ this . pool . end ( ) ;
23
21
24
22
if ( callback ) callback ( ) ;
25
23
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " sharedb-postgres" ,
3
- "version" : " 2 .0.0" ,
3
+ "version" : " 3 .0.0" ,
4
4
"description" : " PostgreSQL adapter for ShareDB" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
14
14
"pg" : " ^7.4.1" ,
15
15
"sharedb" : " ^1.0.0-beta.7"
16
16
}
17
- }
17
+ }
You can’t perform that action at this time.
0 commit comments