[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: keep foreign constraint properly
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: keep foreign constraint properly in |
Date: |
Thu, 30 Nov 2023 12:18:08 +0100 |
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 6cbab996 keep foreign constraint properly in
6cbab996 is described below
commit 6cbab99697f9fd06fe4ed97edaf07414dad4f0db
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Thu Nov 30 20:18:00 2023 +0900
keep foreign constraint properly in
---
contrib/taler-exchange-dbconfig | 2 +-
src/exchangedb/0002-batch_deposits.sql | 28 +++++++++++++++++++++-------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/contrib/taler-exchange-dbconfig b/contrib/taler-exchange-dbconfig
index 8fb05d73..b13ba153 100755
--- a/contrib/taler-exchange-dbconfig
+++ b/contrib/taler-exchange-dbconfig
@@ -134,7 +134,7 @@ fi
if [ 0 = "$SKIP_DBINIT" ]
then
echo "Initializing database '$DBNAME'." 1>&2
- sudo -u "$DBUSER" taler-exchange-dbinit
+ sudo -u "$DBUSER" taler-exchange-dbinit -c "$CFGFILE"
fi
if [ 0 = "$SKIP_DBINIT" ] || [ 1 = "$FORCE_PERMS" ]
diff --git a/src/exchangedb/0002-batch_deposits.sql
b/src/exchangedb/0002-batch_deposits.sql
index 57a476a9..71a4b420 100644
--- a/src/exchangedb/0002-batch_deposits.sql
+++ b/src/exchangedb/0002-batch_deposits.sql
@@ -111,13 +111,6 @@ BEGIN
' PRIMARY KEY (batch_deposit_serial_id) '
',ADD CONSTRAINT ' || table_name || '_merchant_pub_h_contract_terms'
' UNIQUE (shard, merchant_pub, h_contract_terms)'
- -- The policy_details_serial_id is a foreign key.
- -- But, due to partitioning its table by a different column, we can not
- -- simply reference policy_details_serial_id of the policy_details. Thus,
- -- the following is commented out:
- -- ',ADD CONSTRAINT ' || table_name || '_foreign_policy_details'
- -- ' FOREIGN KEY (policy_details_serial_id) '
- -- ' REFERENCES policy_details (policy_details_serial_id) ON DELETE
RESTRICT'
);
EXECUTE FORMAT (
'CREATE INDEX ' || table_name || '_by_ready '
@@ -137,6 +130,22 @@ BEGIN
END
$$;
+CREATE OR REPLACE FUNCTION foreign_table_batch_deposits()
+RETURNS VOID
+LANGUAGE plpgsql
+AS $$
+DECLARE
+ table_name TEXT DEFAULT 'batch_deposits';
+BEGIN
+ EXECUTE FORMAT (
+ 'ALTER TABLE ' || table_name ||
+ ' ADD CONSTRAINT ' || table_name || '_foreign_policy_details'
+ ' FOREIGN KEY (policy_details_serial_id) '
+ ' REFERENCES policy_details (policy_details_serial_id) ON DELETE RESTRICT'
+ );
+END
+$$;
+
INSERT INTO exchange_tables
(name
@@ -154,5 +163,10 @@ INSERT INTO exchange_tables
,'exchange-0002'
,'constrain'
,TRUE
+ ,FALSE),
+ ('batch_deposits'
+ ,'exchange-0002'
+ ,'foreign'
+ ,TRUE
,FALSE)
;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: keep foreign constraint properly in,
gnunet <=