postgres-migrate

1.1.2 • Public • Published

postgres-migrate

NPM version Build Status

Migrations for PostgreSQL databases utilizing advisory locks.

Usage

Keep your migration files in a separate folder, as individual .sql files.

var migrate = require('postgres-migrate');
 
migrate({
    conString: 'postgres://dbuser:dbpass@dbhost:32321/dbname',
    migrationsDir: 'path/to/migrationsDirectory',
    reporter: console.log.bind(console) // optional parameter
}).then(function () {
    // The database is ready to be used!
}).catch(function (err) {
    // Something bad happened!
});

You can safely start multiple workers at the same time. Only one of them will take the lock, and upgrade the database. The others will wait for the migration to be completed, and then resolve the promise.

Readme

Keywords

none

Package Sidebar

Install

npm i postgres-migrate

Weekly Downloads

11

Version

1.1.2

License

BSD-3-Clause

Last publish

Collaborators

  • gustavnikolaj