Modeled after twrobel3's CockroachDB driver for mattes/migrate.
All db connection params are defined in the URL string, see this to know what's supported.
Migration script names should take the form <int_version>_<title>.up.sql
and <int_version>_<title>.down.sql
. I recommend using a timestamp (seconds since epoch) for <int_version>
values.
By default, each migration script will run within a transaction, but you can opt-out of this by including the comment:
-- disable_ddl_transaction
as the first line in your script. Due to the nature of CockroachDB, disabling transactions may be necessary for scripts that need to alter the schema and insert reference/seed data.
Note that advisory locks are not supported in CockroachDB; therefore a manual lock table (with default name schema_lock
) is used. This driver will acquire the lock and release it at the beginning and end of every migration script.
See db-journey/journey for details on using the journey
CLI.