From 1009084e94b8e8cf19e3b5568c3cccaba2bd2209 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Thu, 11 Aug 2022 23:35:33 +0200
Subject: major rework of the KYC logic, making it more configurable, not
 complete, but tests pass again

---
 src/exchangedb/common-0001.sql | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/exchangedb/common-0001.sql')

diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index 76185572c..7829b0b34 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -99,11 +99,12 @@ BEGIN
   PERFORM create_partitioned_table(
     'CREATE TABLE IF NOT EXISTS %I'
       '(legitimization_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
-      ',h_payto BYTEA NOT NULL CHECK (LENGTH(h_payto)=64)'
+      ',h_payto BYTEA NOT NULL CHECK (LENGTH(h_payto)=32)'
       ',expiration_time INT8 NOT NULL DEFAULT (0)'
       ',provider_section VARCHAR NOT NULL'
       ',provider_user_id VARCHAR DEFAULT NULL'
       ',provider_legitimization_id VARCHAR DEFAULT NULL'
+      ',UNIQUE (h_payto, provider_section)'
     ') %s ;'
     ,'legitimizations'
     ,'PARTITION BY HASH (h_payto)'
@@ -898,6 +899,7 @@ BEGIN
       '(amount_val INT8 NOT NULL'
       ',amount_frac INT4 NOT NULL'
       ',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
+      ',merchant_pub BYTEA CHECK (LENGTH(merchant_pub)=32)'
       ',exchange_account_section TEXT NOT NULL'
       ',wtid_raw BYTEA NOT NULL CHECK (LENGTH(wtid_raw)=32)'
       ') %s ;'
-- 
cgit v1.2.3

