1+ -- ─────────────────────────────────────────────
2+ -- Drop custom TLV record tables first (they have no dependents).
3+ -- ─────────────────────────────────────────────
4+
5+ DROP TABLE IF EXISTS payment_hop_custom_records;
6+ DROP TABLE IF EXISTS payment_attempt_first_hop_custom_records;
7+ DROP TABLE IF EXISTS payment_first_hop_custom_records;
8+
9+ -- ─────────────────────────────────────────────
10+ -- Drop per-hop payload tables before dropping the base hops table.
11+ -- ─────────────────────────────────────────────
12+
13+ DROP TABLE IF EXISTS payment_route_hop_blinded;
14+ DROP TABLE IF EXISTS payment_route_hop_amp;
15+ DROP TABLE IF EXISTS payment_route_hop_mpp;
16+
17+ -- ─────────────────────────────────────────────
18+ -- Drop route hops table and its indexes.
19+ -- ─────────────────────────────────────────────
20+
21+ DROP INDEX IF EXISTS idx_route_hops_htlc_attempt_index;
22+ DROP TABLE IF EXISTS payment_route_hops;
23+
24+ -- ─────────────────────────────────────────────
25+ -- Drop HTLC attempt resolution table and its indexes.
26+ -- ─────────────────────────────────────────────
27+
28+ DROP INDEX IF EXISTS idx_htlc_resolutions_type;
29+ DROP INDEX IF EXISTS idx_htlc_resolutions_time;
30+ DROP TABLE IF EXISTS payment_htlc_attempt_resolutions;
31+
32+ -- ─────────────────────────────────────────────
33+ -- Drop HTLC attempts table and its indexes.
34+ -- ─────────────────────────────────────────────
35+
36+ DROP INDEX IF EXISTS idx_htlc_payment_id;
37+ DROP INDEX IF EXISTS idx_htlc_attempt_index;
38+ DROP INDEX IF EXISTS idx_htlc_payment_hash;
39+ DROP INDEX IF EXISTS idx_htlc_attempt_time;
40+ DROP TABLE IF EXISTS payment_htlc_attempts;
41+
42+ -- ─────────────────────────────────────────────
43+ -- Drop payments table and its indexes.
44+ -- ─────────────────────────────────────────────
45+
46+ DROP INDEX IF EXISTS idx_payments_created_at;
47+ DROP TABLE IF EXISTS payments;
48+
49+ -- ─────────────────────────────────────────────
50+ -- Drop payment intents table and its indexes.
51+ -- ─────────────────────────────────────────────
52+
53+ DROP INDEX IF EXISTS idx_payment_intents_type;
54+ DROP TABLE IF EXISTS payment_intents;
0 commit comments