postgres-migrate-cli
Migrations tool for PostgreSQL
Install
npm i postgres-migrate-cli
Usage
postgres-migrate-cli [command] [options] options: --table - table name in DB to store migrations. Default is `migrations` --config - path to configuration file. Default is `./config.json` --path - path to migrations folder. Default is `./migrations` --count - count of applied/reverted migrations
Config format:
By default used development
config. Please use NODE_ENV to switch config
Migration file format
moduleexports = up: 'ALTER TABLE my_cool_table ADD COLUMN super_column TEXT;' down: 'ALTER TABLE my_cool_table DROP COLUMN super_column;'
where up
and down
is plain SQL:
up
section applies migrationdown
section revert migration
package.json
In your You may have some scripts in your package.json: