-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
migrate-list
subcommand that lists available migrations (#534)
Here, add a new `migrate-list` command to the River CLI. It prints the versions and names of available migrations along with an indicator as to the current state of the database: $ go run ./cmd/river migrate-list --database-url postgres:///river_dev 001 create river migration 002 initial schema 003 river job tags non null 004 pending and more * 005 migration unique client It's pretty far from a high priority feature, but I started it a few weeks ago and I figured I may as well finish it. I started because I realized that despite having a `migrate-get` command, there was no way to figure out what migrations actually existed before you ran it. `migrate-list` currently requires a `--database-url`, but later I want to put in an alternate version that can work without one too. A complication with that is that I want to build a system that can hint on the desired database system (currently detected based off URL scheme) in case we add SQLite later. I'm thinking that we'll be able to add an option like `--database postgres` or `--engine postgres` that can act as an alternative to `--database-url`. This will also be useful for `migrate-get`, which also currently has no answer for this. I bring in a test convention for CLI commands so we can start trying to check with more authority that things like expected output stay stable. (Previously, we weren't testing commands except to vet that they will run successfully in CI.) This approach uses mocks because we still have no way of reusing database-based testing infrastructure outside the main package (eventually some of it should go into `rivershared`), but despite that, it should give us reasonable assuredness for now.
- Loading branch information
Showing
7 changed files
with
301 additions
and
4 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
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
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