All Projects → urbica → pg-migrate

urbica / pg-migrate

Licence: MIT license
PostgreSQL migration tool

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pg-migrate

Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+5315.38%)
Mutual labels:  migrations, migration
Node Sqlite
SQLite client for Node.js applications with SQL-based migrations API written in Typescript
Stars: ✭ 642 (+1546.15%)
Mutual labels:  migrations, migration
plow
👨‍🌾 Postgres migrations and seeding made easy
Stars: ✭ 13 (-66.67%)
Mutual labels:  migrations, migration
butterfly
Application transformation tool
Stars: ✭ 35 (-10.26%)
Mutual labels:  migrations, migration
Mongo.migration
On-the-fly migrations with MongoDB C# Driver
Stars: ✭ 99 (+153.85%)
Mutual labels:  migrations, migration
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 7,712 (+19674.36%)
Mutual labels:  migrations, migration
Rxjava2 Android Samples
RxJava 2 Android Examples - Migration From RxJava 1 to RxJava 2 - How to use RxJava 2 in Android
Stars: ✭ 4,950 (+12592.31%)
Mutual labels:  migrations, migration
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+5835.9%)
Mutual labels:  migrations, migration
upscheme
Database migrations and schema updates made easy
Stars: ✭ 737 (+1789.74%)
Mutual labels:  migrations, migration
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (+2048.72%)
Mutual labels:  migrations, migration
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+5612.82%)
Mutual labels:  migrations, migration
migrations
Migrations is a database migration tool that uses go's database/sql from the standard library
Stars: ✭ 17 (-56.41%)
Mutual labels:  migrations, migration
Migrate2Postgres
Easily migrate from other DBMSs to PostgreSQL
Stars: ✭ 47 (+20.51%)
Mutual labels:  migration
sqlize
sql migration schema generate from models
Stars: ✭ 47 (+20.51%)
Mutual labels:  migration
couchmove
Java data migration tool for Couchbase
Stars: ✭ 36 (-7.69%)
Mutual labels:  migration
migrant
Migration management for PostgreSQL/SQLite/MySQL
Stars: ✭ 85 (+117.95%)
Mutual labels:  migrations
db-migrator.go
DB migrations. CLI and Golang
Stars: ✭ 13 (-66.67%)
Mutual labels:  migrations
harmonica
Kotlin Database Migration Tool. This tool makes it really easy to create table, index, add columns, and so on, with Kotlin DSL.
Stars: ✭ 123 (+215.38%)
Mutual labels:  migration
modoboa-imap-migration
An extension to ease the migration between 2 IMAP servers using offlineimap
Stars: ✭ 14 (-64.1%)
Mutual labels:  migration
migrate-rethinkdb
A migration tool for rethink db
Stars: ✭ 16 (-58.97%)
Mutual labels:  migrations

Urbica PG Migrate

npm version npm downloads CI

PostgreSQL migration tool.

Documentation.

Screenshot

Installation

pg-migrate requires node v7.6.0 or higher for ES2015 and async function support.

npm install -g @urbica/pg-migrate

...or build from source

git clone https://github.com/urbica/pg-migrate.git
cd pg-migrate
npm install

Usage

Usage:
  pg-migrate [options] new <name>
  pg-migrate [options] migrate
  pg-migrate [options] rollback <N>
  pg-migrate [options] reset
  pg-migrate --help
  pg-migrate --version

Examples:
  pg-migrate new create-users
  pg-migrate migrate
  pg-migrate rollback 1
  pg-migrate reset

Options:
  --help                        Show this screen
  --version                     Show version
  --verbose                     Show verbose output
  -m --migrations-dir=DIR       The directory containing your migration files [default: ./migrations]
  -t --migrations-table=TABLE   Set the name of the migrations table          [default: migrations]
  -s --migrations-schema=SCHEMA Set the name of the migrations table scheme   [default: public]

Connection options:
  -c --connection=DATABASE_URL        database connection string in libpq format
  -d --db=PGDATABASE                  database name to connect to
  -h --host=PGHOST                    database server host or socket directory      [default: localhost]
  -p --port=PGPORT                    database server port                          [default: 5432]
  -U --user=PGUSER                    database user name
  -W --password=PGPASSWORD            database user name password

Node.js API

Using Promises

const PgMigrate = require('@urbica/pg-migrate');
const pgMigrate = new PgMigrate({
  database: 'test',
  migrationsDir: './migrations'
});

pgMigrate
  .connect()
  .then(() => pgMigrate.migrate())
  .then(() => pgMigrate.end());

...or using async/await

const pgMigrate = new PgMigrate({ database, user, migrationsDir });

async function migrate() {
  await pgMigrate.connect();
  await pgMigrate.migrate();
  await pgMigrate.end();
}

migrate();

See API for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].