fix(db): idempotent refund_accounts currency migration for re-apply - #679
Merged
Conversation
Production already has currency + refund_accounts_one_per_wallet_currency from the stable-only #667 apply, but the retimestamped 20260817180000 was not in the migrate ledger. Guard the unique constraint with a pg_constraint check so db push can record the version and continue to the identity migrations. Co-authored-by: Francis Ocholi <5ran6@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
5ran6
marked this pull request as ready for review
August 17, 2026 17:39
5ran6
requested review from
Dprof-in-tech,
chibie,
onahprosper and
sundayonah
as code owners
August 17, 2026 17:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Issue
Jira Issue: (Atlassian MCP not authenticated — please file a KAN Bug labeled
noblocksand update this link)Description
After #678 retimestamped migrations, main migrate tried to apply
20260817180000_refund_accounts_per_currency.sqland failed:Notices showed
currencyalready exists andrefund_accounts_one_per_walletalready gone — the #667 DDL was applied to production (stable path) but never recorded under the new version id. The identity migrations never ran because this file aborted first.Make the unique-constraint add idempotent via a
pg_constraintexistence check (same pattern as20260817180200). Column add / old-constraint drop were already safe.Self-review
References
Testing
After merge, main migrate should skip the existing unique constraint, record
20260817180000, then apply20260817180100–20260817180400Confirm no
42P07on refund_accountsThis change adds test coverage for new/changed/fixed functionality
Staging
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.