Skip to content

Make up migrations with TargetVersion idempotent#1261

Open
brandur wants to merge 1 commit into
masterfrom
brandur-idempotent-target-version
Open

Make up migrations with TargetVersion idempotent#1261
brandur wants to merge 1 commit into
masterfrom
brandur-idempotent-target-version

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented May 30, 2026

Here, try to address #1260 by making up migrations with TargetVersion
no longer error if we find that the database has already reached that
target version. These now return idempotently instead as a user
convenience.

Down migrations with TargetVersion already worked with this way, so
although we add a test case to verify this, we don't have to do anything
else.

Fixes #1260.

@brandur brandur force-pushed the brandur-idempotent-target-version branch 2 times, most recently from 9269f42 to cc86558 Compare May 30, 2026 18:11
Here, try to address #1260 by making up migrations with `TargetVersion`
no longer error if we find that the database has already reached that
target version. These now return idempotently instead as a user
convenience.

Down migrations with `TargetVersion` already worked with this way, so
although we add a test case to verify this, we don't have to do anything
else.

Fixes #1260.
Comment thread CHANGELOG.md
⚠️ **Breaking API change:** `rivermigrate.Migrator.Validate` and `rivermigrate.Migrator.ValidateTx` now take a `*rivermigrate.ValidateOpts` parameter. Pass `nil` to preserve previous behavior. We normally endeavor not to make any breaking API changes, but this one will keep the API in a much nicer state, and is on an ancillary function that most installations won't be using. [PR #1259](https://github.com/riverqueue/river/pull/1259)

### Added
### Changed
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think "changed" is actually a bit more appropriate for both these changelog entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migration fails if already migrated up to target version

2 participants