-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
rivermigrate
Go API for running migrations from code + target v…
…ersion support Here, as requested by several users, add a Go API that's able to run migrations as an alternative to migrating via the CLI. We add a new package `rivermigrate` to mirror the conventions of `riverdriver` and `rivertest`. `rivermigrate` is largely just a refactor of the existing internal package `internal/dbmigrate` with a couple important tweaks: * We give it the ability to take a driver the same way as we do for `river.Client` and `rivertest`. * To mirror client and `rivertest` we add a transaction-specific variant that takes a `TTx` (`MigrateTx`). * Because we now have the non-transaction and transaction variants, I take away the `Down`/`Up` function distinctions, and make up/down a parameter to `Migrate`/`MigrateTx` instead (so we only need two functions instead of four). I also added a new option for `TargetVersion` so that it's possible to do a limited migration to a specific version instead of going all the way up or down. This is a pretty standard feature in most migration frameworks. This still can't support Goose because it takes an `sql.DB`, but I think we can get there by adding a minimal driver for the `sql` package that can run migrations and nothing else. More of this to be explored later.
- Loading branch information
Showing
14 changed files
with
814 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.