Methods

$main(opts) → {promise}

Entry point.
Parameters:
Name Type Description
opts object object with {connection: [see url], migrations: [see readme]
Author:
  • Frank Villasenor
Source:
Returns:
A promise which resolves when we're done.
Type
promise

module:dbConnection(connectionStringOrObject, noLocking) → {Database}

This module will create a connection to the database and return it. It is an instance of Database (as used in pg-promise). Once this is require'd once, the same object will be returned througout the app.
Parameters:
Name Type Description
connectionStringOrObject string | object Database Object instance, Connection object or string
noLocking bool If passing in a connection object or string, whether to use locking or not.
Author:
  • Frank Villasenor
Source:
Returns:
the Database instance to use.
Type
Database

module:dbInfo(conn) → {promise}

Manage the meta data for the migration. Tracks the version and returns said version as a promise. If the table (called pg_migration_dbinfo) doesn't exist, it'll be created.
Parameters:
Name Type Description
conn A valid Database instance
Author:
  • Frank Villasenor
Source:
Returns:
A promise with the result {version: {string}}
Type
promise

module:dbMigrate(dbConnection, migrations) → {promise}

Migration module. Used internally to perform the principle database migrations.
Parameters:
Name Type Description
dbConnection external:Database The Database connection on which to perform the actions
migrations object (can probably create a link to more doc)
Author:
  • Frank Villasenor
Source:
Returns:
Which resolves once all
Type
promise