1.0.2 • Published 2 years ago
psql-migrate v1.0.2
psql-migrate
A simple tool to run pure sql migration files for postgres.
- run all sql files in a project (root folder is the first arguement) that have "migration" or "seed" in their name (
yyyy-mm-dd-*.migration|seed.sql
) - run migrations sorted by date (file name should start with the date)
- skip migrations that have already run (store migrations that have run in the db)
- migrate up/down (2nd arguement) using sql comments, see examples in
testFiles
(up
has to come first, and the comments need to have their own line) - add test data using seeds: similar to migrations, but without up/down
Examples TODO:
psql-migrate src
psql-seed src
How to run locally (test using the testFiles
folder as root folder):
yarn up
yarn down
yarn migrate
- this will runup
, because that's the default if you don't supply the arguementyarn seed