Skip to content

Repository files navigation

sharedb-postgres

PostgreSQL database adapter for sharedb. This driver can be used both as a snapshot store and oplog.

Doesn't support queries (yet?).

Moderately experimental. (This drives Synaptograph's backend, and @nornagon hasn't noticed any issues so far.)

Requirements

Due to the fix to resolve high concurency issues Postgres 9.5+ is now required.

Migrating older versions

Older versions of this adaptor used the data type json. You will need to alter the data type prior to using if you are upgrading.

ALTERTABLE ops
ALTER COLUMN operation
SET DATA TYPE jsonb
USING operation::jsonb;
ALTERTABLE snapshots
ALTER COLUMN data
SET DATA TYPE jsonb
USING data::jsonb;

Usage

sharedb-postgres-jsonb wraps native node-postgres, and it supports the same configuration options.

To instantiate a sharedb-postgres wrapper, invoke the module and pass in your PostgreSQL configuration as an argument or use environmental arguments.

For example using environmental arugments:

vardb=require('sharedb-postgres')();varbackend=require('sharedb')({db: db})

Then executing via the command line

PGUSER=dbuser PGPASSWORD=secretpassword PGHOST=database.server.com PGDATABASE=mydb PGPORT=5433 npm start

Example using an object

vardb=require('sharedb-postgres')({host: 'localhost',database: 'mydb'});varbackend=require('sharedb')({db: db})

Error codes

PostgreSQL errors are passed back directly.

Changelog

Note that version 3.0.0 introduces breaking changes in how you specify connection parameters. See the changelog for more info.

Maintained by Playcode

This package is maintained by Playcode, the AI website builder and AI app builder for creating, editing, hosting, and publishing live websites and web apps.

About

PostgreSQL adapter for ShareDB

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages