Skip to content

One-com/node-postgres-migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Postgres migrations from node.js with advisory locks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published