- This is a patch that works for now until @slonik/migrator is compatible with slonik v33.
- Focuses only on migration by .sql files.
Various utilities for slonik
- @slonik/migrator - A cli migration tool for postgres, using slonik.
- @slonik/typegen - A library that uses slonik to generate typescript interfaces based on your sql queries.
- slonik-tools-demo - A demo project which uses @slonik/typegen and @slonik/migrator, intended to show a working example for each package.
Requirements:
- node + yarn
- docker + docker-compose
lerna is used to manage the packages.
To get started:
yarn
yarn dependencies
This starts a local postgres database that the tests will connect to (depends on docker-compose
). After running that in its own window:
yarn ci
will build, migrate and test all packages.
While developing, it can be useful to run yarn build -w
to compile continuously in the background and yarn test
to just run tests. The tests use jest, so all the usual jest features can be used. For example, yarn test packages/migrator
will run the tests only for the migrator package. yarn test $(npx lerna changed --parseable)
runs tests for all changed packages.
Run this workflow. To make sure the correct packages are actually published, it requires a hash of the publish command's dry-run output. You can get this by running the workflow with no parameters, and copying the expected value from the failure logs, or run yarn changes:hash
locally.