Files
lnd/sqldb/sqlc/migrations/000010_payments.down.sql
T
ziggie e9a88267ff paymentsdb: fix duplicate interface check and down migration drop order
- Remove duplicate compile-time interface assertion for SQLStore.

- Fix the down migration to drop payment_intents before payments to
respect the foreign key dependency order. This was not a bug in the
first place bc we have the CASCADE when deleting payments.
2026-02-25 18:36:14 +01:00

54 lines
3.2 KiB
SQL

-- ─────────────────────────────────────────────
-- Drop custom TLV record tables first (they have no dependents).
-- ─────────────────────────────────────────────
DROP TABLE IF EXISTS payment_hop_custom_records;
DROP TABLE IF EXISTS payment_attempt_first_hop_custom_records;
DROP TABLE IF EXISTS payment_first_hop_custom_records;
-- ─────────────────────────────────────────────
-- Drop per-hop payload tables before dropping the base hops table.
-- ─────────────────────────────────────────────
DROP TABLE IF EXISTS payment_route_hop_blinded;
DROP TABLE IF EXISTS payment_route_hop_amp;
DROP TABLE IF EXISTS payment_route_hop_mpp;
-- ─────────────────────────────────────────────
-- Drop route hops table and its indexes.
-- ─────────────────────────────────────────────
DROP INDEX IF EXISTS idx_route_hops_htlc_attempt_index;
DROP TABLE IF EXISTS payment_route_hops;
-- ─────────────────────────────────────────────
-- Drop HTLC attempt resolution table and its indexes.
-- ─────────────────────────────────────────────
DROP INDEX IF EXISTS idx_htlc_resolutions_type;
DROP INDEX IF EXISTS idx_htlc_resolutions_time;
DROP TABLE IF EXISTS payment_htlc_attempt_resolutions;
-- ─────────────────────────────────────────────
-- Drop HTLC attempts table and its indexes.
-- ─────────────────────────────────────────────
DROP INDEX IF EXISTS idx_htlc_payment_id;
DROP INDEX IF EXISTS idx_htlc_attempt_index;
DROP INDEX IF EXISTS idx_htlc_payment_hash;
DROP INDEX IF EXISTS idx_htlc_attempt_time;
DROP TABLE IF EXISTS payment_htlc_attempts;
-- ─────────────────────────────────────────────
-- Drop payment intents table and its indexes.
-- ─────────────────────────────────────────────
DROP INDEX IF EXISTS idx_payment_intents_type;
DROP TABLE IF EXISTS payment_intents;
-- ─────────────────────────────────────────────
-- Drop payments table and its indexes.
-- ─────────────────────────────────────────────
DROP INDEX IF EXISTS idx_payments_created_at;
DROP TABLE IF EXISTS payments;