Simple Utility To Run Migrations With A Retry
If you like any of my work, you can support me on: https://barelyhuman.dev/donate
A few services generate their own migrations for us to use but the order of these migration queries are often invalid and never migrate properly and cause a lot of issues when needed. The cli utility simply goes through the set of queries and runs them with retry attempts to make sure each statement is run at least 3 times. In the future you can obviously change this number.
- Knex compatible so work with any connector, as long as the files also support the same
npm i -g @barelyhuman/grator
- A json config file named
grator.json
or anything as long as you point to it with the needed flag - A folder named
migrations
or any other folder with anup.sql
and adown.sql
file based on requirement
Usage
$ grator [up|down]
Options
--config, -c configuration file [Default: ./grator.json]
--directory, -d migrations directory, should contain up.sql and down.sql [Default: ./migrations]
Examples
$ grator up -c grator.json
$ grator down -c grator.json -d migrations
MIT © Reaper