npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

couch2pg-njuguna

v0.5.0

Published

Library and cli for one-way replicating CouchDB databases to PostgreSQL 9.4+.

Downloads

5

Readme

couch2pg Build Status

Library and cli for one-way replicating CouchDB databases to PostgreSQL 9.4+.

Required database setup

couch2pg supports PostgreSQL 9.4 and greater. The user passed in the postgres url needs to have full creation rights on the given database.

Example cli usage

npm install -g couch2pg`
couch2pg --help

Example library usage

npm install --save couch2pg
var PG_URL = 'postgres://localhost:5432/db-name',
    COUCHDB_URL = 'http://localhost:5984/db-name';

var couchdb = require('pouchdb')(COUCHDB_URL),
    db = require('pg-promise')()(PG_URL);

var couch2pg = require('couch2pg'),
    migrator = couch2pg.migrator(PG_URL),
    importer = couch2pg.importer(db, couchdb);

return migrator()
    .then(importer.importAll);

migrator ensures that the named DB is ready to use, importAll imports all docs from CouchDB into the postgres. If it's been run before against this DB it will pick up from where it left off last time.

Running tests

Enjoy your tests with: npm test.

Some environment variables that may be required for the integration tests to run correctly:

  • INT_PG_HOST: postgres host, defaults to localhost
  • INT_PG_PORT: postgres port, defaults to 5432
  • INT_PG_USER: postgres user, defaults to none (system default). This user must be able to create databases on the given host.
  • INT_PG_PASS: user's password, defaults to none (system default)
  • INT_PG_DB: test databse to use, defaults to medic-analytics-test
  • INT_COUCHDB_URL: url to test couchdb, defaults to http://admin:pass@localhost:5894/medic-analytics-test. The user must have the ability to destory and create databases on that host.

You may be able to get away with not setting any of these, or only needing to set some of these depending on your development environment.

NB: the integration tests destroy and re-create the given databases each time they are run. Use test databases.