From dbff6fa4e5684d8636fd46ecadfe5874a253bd49 Mon Sep 17 00:00:00 2001
From: rtkay123 <dev@kanjala.com>
Date: Sun, 10 Aug 2025 13:45:11 +0200
Subject: feat(pseudonyms): serve api

---
 .../20250810112945_transaction_relationship.sql    | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 crates/pseudonyms/migrations/20250810112945_transaction_relationship.sql

(limited to 'crates/pseudonyms/migrations/20250810112945_transaction_relationship.sql')

diff --git a/crates/pseudonyms/migrations/20250810112945_transaction_relationship.sql b/crates/pseudonyms/migrations/20250810112945_transaction_relationship.sql
new file mode 100644
index 0000000..b28b61c
--- /dev/null
+++ b/crates/pseudonyms/migrations/20250810112945_transaction_relationship.sql
@@ -0,0 +1,29 @@
+create table transaction_relationship (
+    source varchar references account(id),
+    destination varchar references account(id),
+    amt_unit bigint not null,
+    amt_ccy varchar(3) not null,
+    amt_nanos integer not null,
+    cre_dt_tm timestamptz not null,
+    end_to_end_id varchar not null check (trim(end_to_end_id) <> ''),
+    msg_id varchar not null check (trim(msg_id) <> ''),
+    pmt_inf_id varchar not null check (trim(pmt_inf_id) <> ''),
+    tx_tp varchar not null check (trim(tx_tp) <> ''),
+    lat float8,
+    lon float8,
+    tx_sts varchar,
+    primary key (msg_id, end_to_end_id, tx_tp, pmt_inf_id)
+);
+
+create index idx_transaction_status_range
+  on transaction_relationship (tx_tp, tx_sts, cre_dt_tm desc);
+
+create index idx_transaction_e2eid_tp_sts
+  on transaction_relationship (end_to_end_id, tx_tp, tx_sts);
+
+create index idx_transaction_accc_only
+  on transaction_relationship (cre_dt_tm)
+  where tx_sts = 'ACCC';
+
+create index idx_transaction_source_time
+  on transaction_relationship (source, cre_dt_tm desc);
-- 
cgit v1.2.3

