Repository navigation
feat(store): billing invoice and subscription provider ids are unique over live rows only - #1981
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Summary
Merge Risk: 🟡 Moderate · up to
|
Coverage Report for CI Build 38539605563Coverage remained the same at 54.896%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
b0489db to
3711d88
Compare
3711d88 to
8d9f641
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: raystack/frontier/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cff0668b-60f0-45ee-a2c8-6355bd58ae0d
📒 Files selected for processing (4)
internal/store/postgres/billing_invoice_repository_pg_test.gointernal/store/postgres/billing_subscription_repository_pg_test.gointernal/store/postgres/migrations/20261013100000_billing_provider_ids_live_unique.down.sqlinternal/store/postgres/migrations/20261013100000_billing_provider_ids_live_unique.up.sql
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
… over live rows only
8d9f641 to
89bfb1c
Compare
What changes
provider_idof invoices and subscriptions is now unique over live rows only (WHERE deleted_at IS NULL).billing_invoices.provider_idandbilling_subscriptions.provider_idare dropped.billing_subscriptions (provider_id, plan_id)is dropped. The single column index already covers it.Why
This is the first step of making the billing rows soft deleted when an organization is deleted. A soft deleted invoice or subscription keeps its provider id. Without this change a later sync from the billing provider could not insert the same id again, and the plain unique would also make a soft deleted row block a live one.
Nothing writes
deleted_aton these tables yet, so there is no behavior change in this PR.Release note
Safe to deploy on its own. The down migration puts the plain unique constraints back. It fails if two rows share a provider id, which can only happen after rows have been soft deleted.
Tests