Skip to content

Return DBActions from Rollback #929

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 30, 2025
Merged

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Jun 23, 2025

This PR changes the signature of Rollback. From now on, it returns a list of DBActions.

@kvch kvch requested a review from andrew-farries June 23, 2025 14:21
@github-actions github-actions bot temporarily deployed to Docs Preview June 23, 2025 14:21 Inactive
@kvch kvch force-pushed the refactoring-return-actions-from-rollback branch from 7cea307 to bee688d Compare June 23, 2025 14:24
@github-actions github-actions bot temporarily deployed to Docs Preview June 23, 2025 14:25 Inactive
Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

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

Would prefer to return nil slices here and in Complete if possible.

l.LogOperationRollback(o)

table := s.GetTable(o.Table)
if table == nil {
return TableDoesNotExistError{Name: o.Table}
return []DBAction{}, TableDoesNotExistError{Name: o.Table}
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we return nil slices rather than empty slices?

The same also applies to the error returns in the Complete functions.

@kvch kvch force-pushed the refactoring-return-actions-from-rollback branch from bee688d to 7ad76b2 Compare June 24, 2025 13:51
@github-actions github-actions bot temporarily deployed to Docs Preview June 24, 2025 13:51 Inactive
Copy link

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgroll/pkg/migrations 75.42% (+0.13%) 👍
github.com/xataio/pgroll/pkg/roll 79.52% (-0.12%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgroll/pkg/migrations/migrations.go 94.12% (ø) 17 16 1
github.com/xataio/pgroll/pkg/migrations/op_add_column.go 85.98% (+0.64%) 107 (-9) 92 (-7) 15 (-2) 👍
github.com/xataio/pgroll/pkg/migrations/op_alter_column.go 87.96% (+1.48%) 108 (-3) 95 (-1) 13 (-2) 👍
github.com/xataio/pgroll/pkg/migrations/op_change_type.go 92.86% (ø) 14 13 1
github.com/xataio/pgroll/pkg/migrations/op_create_constraint.go 81.90% (+0.49%) 105 (-8) 86 (-6) 19 (-2) 👍
github.com/xataio/pgroll/pkg/migrations/op_create_index.go 69.35% (ø) 62 43 19
github.com/xataio/pgroll/pkg/migrations/op_create_table.go 83.97% (ø) 131 110 21
github.com/xataio/pgroll/pkg/migrations/op_drop_column.go 80.00% (+1.88%) 25 (-7) 20 (-5) 5 (-2) 👍
github.com/xataio/pgroll/pkg/migrations/op_drop_constraint.go 85.71% (+1.71%) 42 (-8) 36 (-6) 6 (-2) 👍
github.com/xataio/pgroll/pkg/migrations/op_drop_index.go 90.91% (ø) 11 10 1
github.com/xataio/pgroll/pkg/migrations/op_drop_multicolumn_constraint.go 89.66% (+3.09%) 58 (-9) 52 (-6) 6 (-3) 👍
github.com/xataio/pgroll/pkg/migrations/op_drop_not_null.go 93.33% (ø) 15 14 1
github.com/xataio/pgroll/pkg/migrations/op_drop_table.go 90.00% (+3.04%) 20 (-3) 18 (-2) 2 (-1) 👍
github.com/xataio/pgroll/pkg/migrations/op_raw_sql.go 88.89% (ø) 18 16 2
github.com/xataio/pgroll/pkg/migrations/op_rename_column.go 93.33% (ø) 30 28 2
github.com/xataio/pgroll/pkg/migrations/op_rename_constraint.go 100.00% (ø) 16 16 0
github.com/xataio/pgroll/pkg/migrations/op_rename_table.go 100.00% (ø) 15 15 0
github.com/xataio/pgroll/pkg/migrations/op_set_check.go 86.96% (ø) 23 20 3
github.com/xataio/pgroll/pkg/migrations/op_set_comment.go 90.00% (ø) 10 9 1
github.com/xataio/pgroll/pkg/migrations/op_set_default.go 85.71% (ø) 21 18 3
github.com/xataio/pgroll/pkg/migrations/op_set_fk.go 75.00% (ø) 32 24 8
github.com/xataio/pgroll/pkg/migrations/op_set_notnull.go 86.36% (ø) 22 19 3
github.com/xataio/pgroll/pkg/migrations/op_set_replica_identity.go 100.00% (ø) 21 21 0
github.com/xataio/pgroll/pkg/migrations/op_set_unique.go 77.27% (ø) 22 17 5
github.com/xataio/pgroll/pkg/roll/execute.go 78.36% (-0.21%) 171 (+3) 134 (+2) 37 (+1) 👎

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.

@kvch kvch requested a review from andrew-farries June 24, 2025 13:53
@kvch kvch merged commit 12dd5a2 into main Jun 30, 2025
30 checks passed
@kvch kvch deleted the refactoring-return-actions-from-rollback branch June 30, 2025 08:56
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