gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: update schema to fix broken prim


From: gnunet
Subject: [taler-exchange] branch master updated: update schema to fix broken primary key constraint
Date: Thu, 28 Mar 2024 13:05:49 +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 517876451 update schema to fix broken primary key constraint
517876451 is described below

commit 517876451e1a40ca18a1860fb1fa4088f3e0408c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Mar 28 13:05:45 2024 +0100

    update schema to fix broken primary key constraint
---
 src/exchangedb/0004-refunds.sql     | 35 +++++++++++++++++++++++++++++++++++
 src/exchangedb/Makefile.am          | 10 +++++++++-
 src/exchangedb/exchange-0004.sql.in | 24 ++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/src/exchangedb/0004-refunds.sql b/src/exchangedb/0004-refunds.sql
new file mode 100644
index 000000000..71666d9db
--- /dev/null
+++ b/src/exchangedb/0004-refunds.sql
@@ -0,0 +1,35 @@
+
+CREATE FUNCTION constrain_table_refunds4 (
+  IN partition_suffix TEXT DEFAULT NULL
+)
+RETURNS void
+LANGUAGE plpgsql
+AS $$
+DECLARE
+  table_name TEXT DEFAULT 'refunds';
+BEGIN
+  table_name = concat_ws('_', table_name, partition_suffix);
+
+  EXECUTE FORMAT (
+    'ALTER TABLE ' || table_name ||
+    ' DROP CONSTRAINT refunds_pkey'
+  );
+  EXECUTE FORMAT (
+    'ALTER TABLE ' || table_name ||
+    ' ADD PRIMARY KEY (batch_deposit_serial_id, coin_pub, rtransaction_id) '
+  );
+END
+$$;
+
+INSERT INTO exchange_tables
+    (name
+    ,version
+    ,action
+    ,partitioned
+    ,by_range)
+  VALUES
+    ('refunds4'
+    ,'exchange-0004'
+    ,'constrain'
+    ,TRUE
+    ,FALSE);
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index 45070ac08..d57d690a1 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -19,8 +19,10 @@ sqlinputs = \
   procedures.sql.in \
   0002-*.sql \
   0003-*.sql \
+  0004-*.sql \
   exchange-0002.sql.in \
-  exchange-0003.sql.in
+  exchange-0003.sql.in \
+  exchange-0004.sql.in
 
 sql_DATA = \
   benchmark-0001.sql \
@@ -29,6 +31,7 @@ sql_DATA = \
   exchange-0001.sql \
   exchange-0002.sql \
   exchange-0003.sql \
+  exchange-0004.sql \
   drop.sql \
   procedures.sql
 
@@ -58,6 +61,11 @@ exchange-0003.sql: exchange-0003.sql.in 0003-*.sql
        gcc -E -P -undef - < exchange-0003.sql.in 2>/dev/null | sed -e 
"s/--.*//" | awk 'NF' - >$@
        chmod ugo-w $@
 
+exchange-0004.sql: exchange-0004.sql.in 0004-*.sql
+       chmod +w $@ || true
+       gcc -E -P -undef - < exchange-0004.sql.in 2>/dev/null | sed -e 
"s/--.*//" | awk 'NF' - >$@
+       chmod ugo-w $@
+
 check_SCRIPTS = \
   test_idempotency.sh
 
diff --git a/src/exchangedb/exchange-0004.sql.in 
b/src/exchangedb/exchange-0004.sql.in
new file mode 100644
index 000000000..c966aedc5
--- /dev/null
+++ b/src/exchangedb/exchange-0004.sql.in
@@ -0,0 +1,24 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2024 Taler Systems SA
+--
+-- TALER is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+-- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+--
+
+BEGIN;
+
+SELECT _v.register_patch('exchange-0004', NULL, NULL);
+SET search_path TO exchange;
+
+#include "0004-refunds.sql"
+
+COMMIT;

-- 
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]