Skip to content

Move Status method to roll package #921

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 4 commits into from
Jun 20, 2025

Conversation

andrew-farries
Copy link
Collaborator

@andrew-farries andrew-farries commented Jun 19, 2025

Move Status functionality from state to roll package.

Refactor the migration status functionality by moving it from the state package to the roll package.

This change improves the architecture by:

  • Better separation of concerns: The state package should focus purely on persistence operations, while migration status reporting belongs in the roll package alongside other migration orchestration logic

  • Better test coverage: by moving functionality into the packages that use them, rather than having the functionality of one package tested by tests in another.

@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 14:10 Inactive
@andrew-farries andrew-farries changed the title Move Status method to `Roll package Move Status method to roll package Jun 19, 2025
@andrew-farries andrew-farries force-pushed the move-state-status-to-roll-package branch from 739bbd4 to 390859a Compare June 19, 2025 14:12
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 14:12 Inactive
- Move `Status` type, `MigrationStatus` type, and related
  constants from `pkg/state/status.go` to `pkg/roll/status.go`
- Move `Status` method from `State` receiver to `Roll` receiver
- Remove `Status` method from state package

This improves the architecture by placing migration status
reporting in the roll package where it conceptually belongs,
rather than in the low-level state persistence package.
Construct a new `Roll` instance to use the `Status` method.
@andrew-farries andrew-farries force-pushed the move-state-status-to-roll-package branch from 390859a to 7ad8c74 Compare June 19, 2025 14:13
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 14:13 Inactive
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgroll/cmd 0.00% (ø)
github.com/xataio/pgroll/pkg/roll 80.00% (+0.26%) 👍
github.com/xataio/pgroll/pkg/state 70.78% (+4.12%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgroll/cmd/status.go 0.00% (ø) 13 (-2) 0 13 (-2)
github.com/xataio/pgroll/pkg/roll/roll.go 76.09% (-0.51%) 46 (-1) 35 (-1) 11 👎
github.com/xataio/pgroll/pkg/roll/status.go 86.67% (+86.67%) 15 (+15) 13 (+13) 2 (+2) 🌟
github.com/xataio/pgroll/pkg/state/state.go 63.70% (+5.93%) 146 (-15) 93 53 (-15) 👍
github.com/xataio/pgroll/pkg/state/status.go 0.00% (ø) 0 0 0

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/execute_test.go

@andrew-farries andrew-farries marked this pull request as ready for review June 19, 2025 14:17
@andrew-farries andrew-farries requested a review from kvch June 19, 2025 14:18
@andrew-farries andrew-farries merged commit 31dd8d1 into main Jun 20, 2025
30 checks passed
@andrew-farries andrew-farries deleted the move-state-status-to-roll-package branch June 20, 2025 06:30
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