aboutsummaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-06-16 17:44:20 +0200
committerFlorian Dold <florian@dold.me>2024-06-16 17:44:20 +0200
commit92001c4385f0d5cb43b5c3ee589629f0da420e34 (patch)
tree55749c6415b2b5e00dc5a8ad64e38b889c7b335f /src/backenddb
parent4f91af9910c31259b546b96cb01e49f9a944e10c (diff)
remove redundant required_currency field/column
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/merchant-0009.sql33
-rw-r--r--src/backenddb/merchantdb_helper.c1
-rw-r--r--src/backenddb/pg_insert_template.c6
-rw-r--r--src/backenddb/pg_lookup_template.c5
-rw-r--r--src/backenddb/pg_update_template.c4
5 files changed, 34 insertions, 15 deletions
diff --git a/src/backenddb/merchant-0009.sql b/src/backenddb/merchant-0009.sql
new file mode 100644
index 00000000..56705c3e
--- /dev/null
+++ b/src/backenddb/merchant-0009.sql
@@ -0,0 +1,33 @@
+--
+-- 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/>
+--
+
+-- @file merchant-0009.sql
+-- @brief Remove redundant required_currencies column
+-- @author Florian Dold
+
+-- Everything in one big transaction
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('merchant-0009', NULL, NULL);
+
+SET search_path TO merchant
+ DROP COLUMN required_currency;
+
+ALTER TABLE merchant_template ;
+
+-- Complete transaction
+COMMIT;
diff --git a/src/backenddb/merchantdb_helper.c b/src/backenddb/merchantdb_helper.c
index 6c1d2ec6..72b1c9a7 100644
--- a/src/backenddb/merchantdb_helper.c
+++ b/src/backenddb/merchantdb_helper.c
@@ -43,7 +43,6 @@ TALER_MERCHANTDB_template_details_free (
{
GNUNET_free (tp->template_description);
GNUNET_free (tp->otp_id);
- GNUNET_free (tp->required_currency);
json_decref (tp->editable_defaults);
json_decref (tp->template_contract);
}
diff --git a/src/backenddb/pg_insert_template.c b/src/backenddb/pg_insert_template.c
index 67cae495..a755ba9a 100644
--- a/src/backenddb/pg_insert_template.c
+++ b/src/backenddb/pg_insert_template.c
@@ -45,9 +45,6 @@ TMH_PG_insert_template (void *cls,
(NULL == td->editable_defaults)
? GNUNET_PQ_query_param_null ()
: TALER_PQ_query_param_json (td->editable_defaults),
- (NULL == td->required_currency)
- ? GNUNET_PQ_query_param_null ()
- : GNUNET_PQ_query_param_string (td->required_currency),
GNUNET_PQ_query_param_end
};
@@ -61,10 +58,9 @@ TMH_PG_insert_template (void *cls,
",otp_device_id"
",template_contract"
",editable_defaults"
- ",required_currency"
")"
" SELECT merchant_serial,"
- " $2, $3, $4, $5, $6, $7"
+ " $2, $3, $4, $5, $6"
" FROM merchant_instances"
" WHERE merchant_id=$1");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
diff --git a/src/backenddb/pg_lookup_template.c b/src/backenddb/pg_lookup_template.c
index 6e9d3681..95b097df 100644
--- a/src/backenddb/pg_lookup_template.c
+++ b/src/backenddb/pg_lookup_template.c
@@ -56,7 +56,6 @@ TMH_PG_lookup_template (void *cls,
" mt.template_description"
",mod.otp_id"
",mt.template_contract"
- ",mt.required_currency"
",mt.editable_defaults"
" FROM merchant_template mt"
" JOIN merchant_instances mi"
@@ -85,10 +84,6 @@ TMH_PG_lookup_template (void *cls,
GNUNET_PQ_result_spec_string ("otp_id",
&td->otp_id),
NULL),
- GNUNET_PQ_result_spec_allow_null (
- GNUNET_PQ_result_spec_string ("required_currency",
- &td->required_currency),
- NULL),
TALER_PQ_result_spec_json ("template_contract",
&td->template_contract),
GNUNET_PQ_result_spec_allow_null (
diff --git a/src/backenddb/pg_update_template.c b/src/backenddb/pg_update_template.c
index c0c35df3..98259624 100644
--- a/src/backenddb/pg_update_template.c
+++ b/src/backenddb/pg_update_template.c
@@ -44,9 +44,6 @@ TMH_PG_update_template (void *cls,
(NULL == td->editable_defaults)
? GNUNET_PQ_query_param_null ()
: TALER_PQ_query_param_json (td->editable_defaults),
- (NULL == td->required_currency)
- ? GNUNET_PQ_query_param_null ()
- : GNUNET_PQ_query_param_string (td->required_currency),
GNUNET_PQ_query_param_end
};
@@ -69,7 +66,6 @@ TMH_PG_update_template (void *cls,
" FROM otp), NULL)"
",template_contract=$5"
",editable_defaults=$6"
- ",required_currency=$7"
" WHERE merchant_serial="
" (SELECT merchant_serial"
" FROM mid)"