-- invoices.payment_id was hard-FK'd to payments(id) only, which is fine
-- while TRACECOIN_PURCHASE is the only invoice_type in existence, but blocks
-- adding AI_CREDIT_PURCHASE invoices (ai_credits.rs's verify_order) since
-- those reference ai_credit_orders(id), a completely separate table.
-- Postgres has no native polymorphic FK, so drop the constraint and rely on
-- invoice_type to say which table payment_id actually points into -- the
-- same pattern crates/invoice/src/service.rs's NewInvoice.payment_id was
-- already written generically (just a Uuid, not tied to one table) to
-- support.

BEGIN;

ALTER TABLE invoices DROP CONSTRAINT IF EXISTS invoices_payment_id_fkey;

COMMIT;
