chore: invoke bulk invoice schema migration#4729
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| SELECT DISTINCT l.customer_id::TEXT | ||
| FROM billing_customer_locks l | ||
| JOIN billing_invoices i | ||
| ON i.namespace = l.namespace |
There was a problem hiding this comment.
Missing Lock Rows Skip Invoices
The inner join excludes every schema-level-1 invoice whose customer has no billing_customer_locks row. Because these rows are created lazily and invoices predate the lock table, an untouched historical customer can be omitted, leaving its invoices at schema level 1 after this irreversible migration.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tools/migrate/migrations/20260716150457_migrate_invoices_to_schema_level_2.up.sql
Line: 10-13
Comment:
**Missing Lock Rows Skip Invoices**
The inner join excludes every schema-level-1 invoice whose customer has no `billing_customer_locks` row. Because these rows are created lazily and invoices predate the lock table, an untouched historical customer can be omitted, leaving its invoices at schema level 1 after this irreversible migration.
**Context Used:** AGENTS.md ([source](https://app.greptile.com/openmeter/github/openmeterio/openmeter/-/custom-context?memory=eb020e3b-8e3b-45ea-a8b7-4006b2b2065b))
How can I resolve this? If you propose a fix, please make it concise.331f0ae to
308c9d8
Compare
17c8e28 to
840a665
Compare
308c9d8 to
a6d5217
Compare
Overview
Invoke the set-based multi-customer invoice migration function for existing schema-level-1 invoices.
This PR is stacked on top of #4727, which introduces
om_func_migrate_customer_invoices_to_schema_level_2_bulk(TEXT[]).Changes
This layer intentionally contains no detailed-line copying logic or explicit
ANALYZE. The temporary table is dropped automatically when the transaction commits.Validation
atlas migrate --env local lint --latest 1atlas migrate validate --env localgit diff --checkGreptile Summary
This PR migrates existing invoices to schema level 2 in one transaction. The main changes are:
Confidence Score: 5/5
No additional merge-blocking issue requires a separate code change.
Important Files Changed
Reviews (3): Last reviewed commit: "chore: invoke bulk invoice schema migrat..." | Re-trigger Greptile
Context used: