3.0.0 • Published 6 years ago

pg-migration v3.0.0

Weekly downloads
22
License
MIT
Repository
github
Last release
6 years ago

pg-migration

What is it?

NodeJS lacks support for good proper ORMs, and most ORMs tend to suck a bit in the end anyway. For inventid I therefore developed this simple nodejs version for postgresql of Liquibase. It is based on the excellent node-postgres library.

The database changelog table

pg-migration will automatically create the table (dbchangelog) for you.

How to use

  1. Import the library import migration from 'pg-migration';
  2. Configure the library: const migrateAndStart = migration({ log: (level, message) => { your logging code here } })
  3. Create a valid database client connection
  4. Create the migration, with that client, and a callback to the server start (e.g. migrateAndStart(db, './migrations', startServer);)

Files called README.md and dbchangelog.sql from the migrations folder are ignored.

Since the changeset id is derived from the file name, you can use the following command to create a new one

touch `date +%Y%m%d%H%M%S`.sql

Please be careful that the files will be executed in a alphabetically sorted fashion, so ensure that files do not depend on anything later (it's really a poor mans Liquibase).

3.0.0

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago