From a04425df340e9bef067cbf64809ced5597576dfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= <oec-taler@kesim.org>
Date: Fri, 12 May 2023 15:10:23 +0200
Subject: [age-withdraw] WIP: change schema to use new support for array types,
 11/n

---
 src/exchangedb/0003-age_withdraw_reveals.sql | 37 ++++------------------------
 1 file changed, 5 insertions(+), 32 deletions(-)

(limited to 'src/exchangedb/0003-age_withdraw_reveals.sql')

diff --git a/src/exchangedb/0003-age_withdraw_reveals.sql b/src/exchangedb/0003-age_withdraw_reveals.sql
index 1c55fb190..2ab73f4b1 100644
--- a/src/exchangedb/0003-age_withdraw_reveals.sql
+++ b/src/exchangedb/0003-age_withdraw_reveals.sql
@@ -27,14 +27,11 @@ BEGIN
     'CREATE TABLE %I'
       '(age_withdraw_revealed_coins_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE
       ',h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=64)'
-      ',freshcoin_index INT4 NOT NULL'
-      ',denominations_serial INT8 NOT NULL'
-      ',coin_ev BYTEA NOT NULL'
+      ',coin_index INT4 NOT NULL'
       ',h_coin_ev BYTEA CHECK (LENGTH(h_coin_ev)=64)'
-      ',ev_sig BYTEA NOT NULL'
     ') %s ;'
     ,table_name
-    ,'PARTITION BY HASH (h_commitment)'
+    ,'PARTITION BY HASH (h_coin_ev)'
     ,partition_suffix
   );
   PERFORM comment_partitioned_table(
@@ -49,35 +46,17 @@ BEGIN
     ,partition_suffix
   );
   PERFORM comment_partitioned_column(
-     'Index of the coin in the withdraw-age request, which is implicitly a batch request'
-    ,'freshcoin_index'
+     'Index of the coin in the age-withdraw request, which is implicitly a batch request'
+    ,'coin_index'
     ,table_name
     ,partition_suffix
   );
   PERFORM comment_partitioned_column(
-     'Foreign key reference to the denominations'
-    ,'denominations_serial'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Envelope of the new coin to be signed'
-    ,'coin_ev'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Hash of the envelope of the new coin to be signed (for lookups)'
+     'Hash of the envelope of the new coin to be signed (for lookups).  The corresponding signatures are stores in age_withdraw_commitments.denom_sigs.'
     ,'h_coin_ev'
     ,table_name
     ,partition_suffix
   );
-  PERFORM comment_partitioned_column(
-     'Exchange signature over the envelope'
-    ,'ev_sig'
-    ,table_name
-    ,partition_suffix
-  );
 END
 $$;
 
@@ -118,12 +97,6 @@ BEGIN
     ' FOREIGN KEY (h_commitment)'
     ' REFERENCES age_withdraw_commitments (h_commitment) ON DELETE CASCADE;'
   );
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_denominations_serial'
-    ' FOREIGN KEY (denominations_serial) '
-    ' REFERENCES denominations (denominations_serial) ON DELETE CASCADE;'
-  );
 END
 $$;
 
-- 
cgit v1.2.3

