-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add river validate
command to check for unapplied migrations
#170
Conversation
31c3470
to
353e525
Compare
This one's a feature request from a few months from [1] in which we add a `river validate` command which fails with a non-zero exit code in case there are unapplied migrations in the target database. As described in the original discussion, this could be used in a project's CI to detect and fail in the presence of a new migration that was part of a River version update (giving people an easy way to check programmatically so that upgrades aren't as dependent on a user successfully seeing a new migration in the changelog). [1] #68
353e525
to
c7bbf01
Compare
@@ -2,7 +2,7 @@ module github.com/riverqueue/river/cmd/river | |||
|
|||
go 1.21.4 | |||
|
|||
// replace github.com/riverqueue/river => ../.. | |||
replace github.com/riverqueue/river => ../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncommented to demonstrate that the whole package works, but I'll have to unwind this as I'm cutting a release. We have steps in development.md
that'll theoretically work for this situation ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks
Great, thanks! |
Here, as proposed by the new release instructions in #169, tee up some changes for 0.0.17, updating `CHANGELOG.md` with the new section and modifying `go.mod` files to point to the new release. Unfortunate note no. 1: the `go.mod` files change from 0.0.15 to 0.0.17 instead of starting at 0.0.16 because I accidentally botched the last release by not pushing the `go.mod` changes. Hopefully this new process will correct that so it doesn't happen again. Unfortunate note no. 2: As noted in #169, we expect the build to fail here because `go.mod` files point to a version that doesn't have a tag yet. The new `river validate` is included here (#170) so I'm also going to try a two-phase release by tagging all submodules except for `./cmd/river` with 0.0.17 first, then modifying that submodule to point to the new 0.0.17 in other modules, then do a cut and release for it separately. Kind of a pain, but as discussed at length before, this seems to be the least bad of a bunch of suboptimal options.
Here, as proposed by the new release instructions in #169, tee up some changes for 0.0.17, updating `CHANGELOG.md` with the new section and modifying `go.mod` files to point to the new release. Unfortunate note no. 1: the `go.mod` files change from 0.0.15 to 0.0.17 instead of starting at 0.0.16 because I accidentally botched the last release by not pushing the `go.mod` changes. Hopefully this new process will correct that so it doesn't happen again. Unfortunate note no. 2: As noted in #169, we expect the build to fail here because `go.mod` files point to a version that doesn't have a tag yet. The new `river validate` is included here (#170) so I'm also going to try a two-phase release by tagging all submodules except for `./cmd/river` with 0.0.17 first, then modifying that submodule to point to the new 0.0.17 in other modules, then do a cut and release for it separately. Kind of a pain, but as discussed at length before, this seems to be the least bad of a bunch of suboptimal options.
Follow up #172 by also updating the River CLI to version 0.0.17. This must be done as a separate step because the River CLI module depends on the main module, and therefore the 0.0.17 tag for the main module must exist before we can lock to it from the River CLI. The rough process here was to: * Remove the `replace` statement added in #170 to demonstrate that the new `river validate` command worked. * Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17. * Run `go mod tidy` to update `go.sum` and bump the version of the other River subdependencies too.
Follow up #172 by also updating the River CLI to version 0.0.17. This must be done as a separate step because the River CLI module depends on the main module, and therefore the 0.0.17 tag for the main module must exist before we can lock to it from the River CLI. The rough process here was to: * Remove the `replace` statement added in #170 to demonstrate that the new `river validate` command worked. * Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17. * Run `go mod tidy` to update `go.sum` and bump the version of the other River subdependencies too. After merging this, I'll add and push one last tag: export VERSION=v0.0.17 git tag cmd/river/$VERSION -m "release cmd/river/$VERSION" git push --tags
Follow up #172 by also updating the River CLI to version 0.0.17. This must be done as a separate step because the River CLI module depends on the main module, and therefore the 0.0.17 tag for the main module must exist before we can lock to it from the River CLI. The rough process here was to: * Remove the `replace` statement added in #170 to demonstrate that the new `river validate` command worked. * Modify `./cmd/river/go.mod`'s River dependency to use v0.0.17. * Run `go mod tidy` to update `go.sum` and bump the version of the other River subdependencies too. After merging this, I'll add and push one last tag: export VERSION=v0.0.17 git tag cmd/river/$VERSION -m "release cmd/river/$VERSION" git push --tags
This one's a feature request from a few months from [1] in which we add
a
river validate
command which fails with a non-zero exit code in casethere are unapplied migrations in the target database. As described in
the original discussion, this could be used in a project's CI to detect
and fail in the presence of a new migration that was part of a River
version update (giving people an easy way to check programmatically so
that upgrades aren't as dependent on a user successfully seeing a new
migration in the changelog).
[1] #68