gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: address TODO: this is a foreign


From: gnunet
Subject: [taler-exchange] branch master updated: address TODO: this is a foreign constraint, should be in a foreign helper function
Date: Tue, 17 Oct 2023 14:14:52 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 1c7401cf address TODO: this is a foreign constraint, should be in a 
foreign helper function
1c7401cf is described below

commit 1c7401cf6a72a8e6aeac3a569b64c3d00898a1d1
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Tue Oct 17 14:14:49 2023 +0200

    address TODO: this is a foreign constraint, should be in a foreign helper 
function
---
 src/exchangedb/0002-kyc_attributes.sql | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/exchangedb/0002-kyc_attributes.sql 
b/src/exchangedb/0002-kyc_attributes.sql
index af0b55c3..897aff56 100644
--- a/src/exchangedb/0002-kyc_attributes.sql
+++ b/src/exchangedb/0002-kyc_attributes.sql
@@ -108,8 +108,9 @@ BEGIN
         'UNIQUE (kyc_attributes_serial_id)'
   );
   -- The legitimization_serial is a foreign key.
-  -- TODO: due to partitioning by h_payto, we can not simply reference
-  -- the serial id of the legitimization_processes
+  -- But, due to partitioning by h_payto, we can not simply reference
+  -- the serial id of the legitimization_processes. Thus, the following
+  -- is commented out.
   --  EXECUTE FORMAT (
   --    'ALTER TABLE ' || table_name ||
   --    ' ADD CONSTRAINT ' || table_name || '_foreign_legitimization_processes'
@@ -131,6 +132,22 @@ BEGIN
 END $$;
 
 
+CREATE OR REPLACE FUNCTION foreign_table_kyc_attributes()
+RETURNS void
+LANGUAGE plpgsql
+AS $$
+DECLARE
+  table_name TEXT DEFAULT 'kyc_attributes';
+BEGIN
+  EXECUTE FORMAT (
+    'ALTER TABLE ' || table_name ||
+    ' ADD CONSTRAINT ' || table_name || '_foreign_legitimization_processes'
+    ' FOREIGN KEY (legitimization_serial) '
+    ' REFERENCES legitimization_processes (legitimization_process_serial_id)' 
-- ON DELETE CASCADE
+  );
+END $$;
+
+
 INSERT INTO exchange_tables
     (name
     ,version
@@ -147,4 +164,9 @@ INSERT INTO exchange_tables
     ,'exchange-0002'
     ,'constrain'
     ,TRUE
+    ,FALSE),
+    ('kyc_attributes'
+    ,'exchange-0002'
+    ,'foreign'
+    ,TRUE
     ,FALSE);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]