Skip to content

chore: drop invoice schema migration functions - #4732

Draft
turip wants to merge 1 commit into
feat/invoke-bulk-invoice-schema-level-2-migrationfrom
feat/drop-invoice-schema-migration-functions
Draft

chore: drop invoice schema migration functions#4732
turip wants to merge 1 commit into
feat/invoke-bulk-invoice-schema-level-2-migrationfrom
feat/drop-invoice-schema-migration-functions

Conversation

@turip

@turip turip commented Jul 17, 2026

Copy link
Copy Markdown
Member

Overview

Drop the temporary invoice schema migration helper functions after the bulk schema-level-2 backfill has completed.

Note

This PR is intentionally just a collection of cleanups to be merged later. Keep it open until the bulk backfill has been deployed and older OpenMeter versions that still call the scalar function are no longer in use.

This PR is stacked on top of #4729.

Changes

  • Drop om_func_migrate_customer_invoices_to_schema_level_2(TEXT).
  • Drop om_func_migrate_customer_invoices_to_schema_level_2_bulk(TEXT[]).
  • Do not recreate the completed migration helpers on rollback.

Validation

  • atlas migrate --env local lint --latest 1
  • atlas migrate validate --env local
  • git diff --check

Greptile Summary

This PR removes the completed invoice schema migration helpers. The main changes are:

  • Drops the scalar invoice migration function.
  • Drops the bulk invoice migration function.
  • Leaves both functions absent on rollback.
  • Registers the migration in the Atlas checksum.

Confidence Score: 4/5

The function-removal migration can break invoice processing while scalar or bulk callers remain deployable.

  • Older instances can call the dropped scalar helper during a rolling deployment.
  • The current invoice-lock path can call the dropped bulk helper for remaining schema-level-1 invoices.
  • The Atlas checksum and comment-only down migration follow repository conventions.

tools/migrate/migrations/20260717062143_drop_invoice_schema_migration_functions.up.sql

Important Files Changed

Filename Overview
tools/migrate/migrations/20260717062143_drop_invoice_schema_migration_functions.up.sql Drops both helpers while deployed application versions can still call them.
tools/migrate/migrations/20260717062143_drop_invoice_schema_migration_functions.down.sql Intentionally keeps the helper functions removed during rollback.
tools/migrate/migrations/atlas.sum Adds the new up migration using the repository's normal checksum convention.

Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
tools/migrate/migrations/20260717062143_drop_invoice_schema_migration_functions.up.sql:1-2
**Function Drops Break Active Callers**

During a rolling deployment, an older instance can still call the scalar helper after this migration drops it. The current invoice-lock path can likewise call the bulk helper when it encounters a schema-level-1 invoice, so either state produces a PostgreSQL `function does not exist` error and blocks invoice processing.

Reviews (1): Last reviewed commit: "chore: drop invoice schema migration fun..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

@turip turip added the keep-open Exempt from stale processing; requires a concrete maintainer reason label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fd3cf77a-2f51-4dbc-95d0-4582875bb621

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drop-invoice-schema-migration-functions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment on lines +1 to +2
DROP FUNCTION IF EXISTS om_func_migrate_customer_invoices_to_schema_level_2_bulk(TEXT[]);
DROP FUNCTION IF EXISTS om_func_migrate_customer_invoices_to_schema_level_2(TEXT);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Function Drops Break Active Callers

During a rolling deployment, an older instance can still call the scalar helper after this migration drops it. The current invoice-lock path can likewise call the bulk helper when it encounters a schema-level-1 invoice, so either state produces a PostgreSQL function does not exist error and blocks invoice processing.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tools/migrate/migrations/20260717062143_drop_invoice_schema_migration_functions.up.sql
Line: 1-2

Comment:
**Function Drops Break Active Callers**

During a rolling deployment, an older instance can still call the scalar helper after this migration drops it. The current invoice-lock path can likewise call the bulk helper when it encounters a schema-level-1 invoice, so either state produces a PostgreSQL `function does not exist` error and blocks invoice processing.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keep-open Exempt from stale processing; requires a concrete maintainer reason

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant