fix(db): drop untracked invoices_payment_id_check trigger before 050000 recreates it

Prod has this trigger from an out-of-band creation that was never recorded
in _sqlx_migrations, so migration 20260814050000 failed with 'trigger
already exists' and stopped the whole migrate run partway through.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Ashwin Kumar Sivakumar 2026-08-17 18:37:08 +05:30
parent 92072f04bd
commit e8f4262804
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,2 @@
-- No-op: 20260814050000's up migration recreates the trigger, and its own
-- down migration is responsible for dropping it again.

View file

@ -0,0 +1,9 @@
-- Prod has an `invoices_payment_id_check` trigger that was created outside
-- of sqlx's migration tracking (never recorded in _sqlx_migrations), which
-- made 20260814050000_invoices_payment_id_polymorphic_check.up.sql fail
-- with "trigger already exists" and stop the whole migrate run partway
-- through, blocking every migration after it. Drop the untracked trigger
-- here (a version strictly before 050000) so 050000 can recreate it
-- cleanly and the run proceeds.
DROP TRIGGER IF EXISTS invoices_payment_id_check ON invoices;