Skip to content

Commit 08464ea

Browse files
committed
sqldb: add index and comment to payment tables
1 parent 19ebf84 commit 08464ea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sqldb/sqlc/migrations/000009_payments.up.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ CREATE TABLE IF NOT EXISTS payment_intents (
3232
);
3333

3434
-- Index for efficient querying by intent type
35-
CREATE INDEX IF NOT EXISTS idx_payment_intents_type
35+
CREATE INDEX IF NOT EXISTS idx_payment_intents_type
3636
ON payment_intents(intent_type);
3737

38+
-- Unique constraint for deduplication of payment intents
39+
CREATE UNIQUE INDEX IF NOT EXISTS idx_payment_intents_unique
40+
ON payment_intents(intent_type, intent_payload);
41+
3842
-- ─────────────────────────────────────────────
3943
-- Payments Table
4044
-- ─────────────────────────────────────────────
@@ -187,7 +191,8 @@ CREATE TABLE IF NOT EXISTS payment_htlc_attempt_resolutions (
187191
-- HTLC failure reason code
188192
htlc_fail_reason INTEGER,
189193

190-
-- Failure message from the failing node
194+
-- Failure message from the failing node, this message is binary encoded
195+
-- using the lightning wire protocol, see also lnwire/onion_error.go
191196
failure_msg BLOB,
192197

193198
-- Ensure data integrity: settled attempts must have preimage,

0 commit comments

Comments
 (0)