commit 76cb03874b01587e69f4e2ad54c1063abf462d32
parent f3ae00f1308afed451c75941abd31b1cd0c7b738
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Thu, 8 May 2025 16:01:14 +0200
fix #9865
Diffstat:
3 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am
@@ -34,6 +34,7 @@ sql_DATA = \
merchant-0015.sql \
merchant-0016.sql \
merchant-0017.sql \
+ merchant-0018.sql \
drop.sql
BUILT_SOURCES = \
diff --git a/src/backenddb/merchant-0013.sql b/src/backenddb/merchant-0013.sql
@@ -102,7 +102,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'category_added'
AND merchant_serial = my_merchant_serial
LOOP
@@ -122,7 +122,7 @@ BEGIN
my_merchant_serial::TEXT);
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
@@ -144,7 +144,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'category_updated'
AND merchant_serial = my_merchant_serial
LOOP
@@ -172,7 +172,7 @@ BEGIN
'escape'));
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
@@ -194,7 +194,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'category_deleted'
AND merchant_serial = my_merchant_serial
LOOP
@@ -211,7 +211,7 @@ BEGIN
OLD.category_name);
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
@@ -258,7 +258,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'inventory_added'
AND merchant_serial = my_merchant_serial
LOOP
@@ -314,7 +314,7 @@ BEGIN
NEW.minimum_age::TEXT);
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
@@ -336,7 +336,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'inventory_updated'
AND merchant_serial = my_merchant_serial
LOOP
@@ -431,7 +431,7 @@ BEGIN
NEW.minimum_age::TEXT);
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
@@ -453,7 +453,7 @@ BEGIN
url,
http_method,
body_template
- FROM merchant_webhook
+ FROM merchant.merchant_webhook
WHERE event_type = 'inventory_deleted'
AND merchant_serial = my_merchant_serial
LOOP
@@ -509,7 +509,7 @@ BEGIN
OLD.minimum_age::TEXT);
-- Insert into pending webhooks for this webhook
- INSERT INTO merchant_pending_webhooks
+ INSERT INTO merchant.merchant_pending_webhooks
(merchant_serial, webhook_serial, url, http_method, body)
VALUES
(webhook.merchant_serial,
diff --git a/src/backenddb/merchant-0018.sql b/src/backenddb/merchant-0018.sql
@@ -0,0 +1,37 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2025 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/>
+--
+
+-- @file merchant-0018.sql
+-- @brief Tables for statistics
+-- @author Christian Grothoff
+
+
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('merchant-0018', NULL, NULL);
+
+SET search_path TO merchant;
+
+-- See #9865: inventory locks should not block product or even instance DELETION.
+-- So we need to add the "ON DELETE CASCADE" after all.
+ALTER TABLE merchant_inventory_locks
+ DROP CONSTRAINT merchant_inventory_locks_product_serial_fkey,
+ ADD CONSTRAINT merchant_inventory_locks_product_serial_fkey
+ FOREIGN KEY (product_serial) REFERENCES merchant_inventory(product_serial)
+ ON DELETE CASCADE;
+
+COMMIT;