Skip to content

Update error type returned when Roll.LatestVersionRemote finds no version schema #918

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

Merged
merged 2 commits into from
Jun 18, 2025

Conversation

andrew-farries
Copy link
Collaborator

Ensure that the error returned by Roll.LatestVersionRemote when there are no version schema in the target database makes it clear that there are no version schema rather than no migrations.

When using Roll.WithVersionSchema(false) it's easy to have a situation where there are migrations applied but no version schema; in that case Roll.LatestVersionRemote should return an appropriate error rather than one that says no migrations have been applied.

@github-actions github-actions bot temporarily deployed to Docs Preview June 17, 2025 15:53 Inactive
@andrew-farries andrew-farries marked this pull request as ready for review June 18, 2025 06:47
@andrew-farries andrew-farries requested a review from kvch June 18, 2025 06:47
@andrew-farries andrew-farries force-pushed the rename-disable-view-management-option branch from be1e846 to a4f2b3a Compare June 18, 2025 07:41
@andrew-farries andrew-farries force-pushed the latest-version-remote-with-no-version-schema branch from cece35e to e553c34 Compare June 18, 2025 07:41
@github-actions github-actions bot temporarily deployed to Docs Preview June 18, 2025 07:41 Inactive
Base automatically changed from rename-disable-view-management-option to main June 18, 2025 10:48
Make `LatestVersionRemote` return a specific error when no version
schema is found. This is distinct from the case where no migrations have
been applied, as migrations may exist but not have a version schema such
as for an inferred migration or a migration craeted with version schema
creation disabled.
Ensure that `roll.LatestVersionRemote` returns the expected error:
* When migrations have been applied but none have a version schema.
* When no migrations have been applied.
@andrew-farries andrew-farries force-pushed the latest-version-remote-with-no-version-schema branch from e553c34 to 8e58110 Compare June 18, 2025 10:49
@github-actions github-actions bot temporarily deployed to Docs Preview June 18, 2025 10:49 Inactive
Copy link

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgroll/pkg/roll 79.87% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgroll/pkg/roll/latest.go 86.67% (ø) 30 26 4

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/xataio/pgroll/pkg/roll/latest_test.go

@andrew-farries andrew-farries merged commit c74a242 into main Jun 18, 2025
30 checks passed
@andrew-farries andrew-farries deleted the latest-version-remote-with-no-version-schema branch June 18, 2025 10:54
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.

2 participants