pg-destroy-create-db
v1.0.2 Postgres types type enum enums
PG Destroy Create DB
Given a connection string, destroy/create a database in postgres.
Connects to a transient database gleaned from the passed in connection string (default: 'postgres'). Useful for testing modules that need database setup/teardown.
install
npm install -S pg-destroy-create-db
usage
require('pg-destroy-create-db')('postgres://localhost/some_db')
.destroyCreate( function( error ){
/* ... */
})
API
This module exports a single factory function.
function( connection_string, options ) -> destroyCreatInterface
Options
{
// The database we connect to to perform create/drop ops
transientDb: 'postgres'
}
destroyCreateInterface
.destroyCreate( callback )
Destroy the database then re-create it ignoring any database exists
/database does not exist
errors
.destroy( callback )
Destroy the database, ignoring any database does not exist
errors
.create( callback )
Create the database, ignoring any database exists
errors
npm i pg-destroy-create-db
Metadata
- ISC
- Whatever
- John Fawcett
- released 5/12/2015