diff options
author | Sebastian <sebasjm@gmail.com> | 2022-05-20 11:59:13 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-05-20 11:59:13 -0300 |
commit | eb819195844f6c28d8dd393517f4486132f379c5 (patch) | |
tree | 4651e1d27465778611528ca7c4d258c4e6b02b04 /src/backenddb | |
parent | bc602bc7c77c85fa48babe3997cfe389a59d0861 (diff) | |
download | merchant-eb819195844f6c28d8dd393517f4486132f379c5.tar.gz merchant-eb819195844f6c28d8dd393517f4486132f379c5.tar.bz2 merchant-eb819195844f6c28d8dd393517f4486132f379c5.zip |
add email, site and logo for instances
Diffstat (limited to 'src/backenddb')
-rw-r--r-- | src/backenddb/drop0002.sql | 31 | ||||
-rw-r--r-- | src/backenddb/merchant-0002.sql | 14 | ||||
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 46 |
3 files changed, 88 insertions, 3 deletions
diff --git a/src/backenddb/drop0002.sql b/src/backenddb/drop0002.sql new file mode 100644 index 00000000..cfb6773c --- /dev/null +++ b/src/backenddb/drop0002.sql @@ -0,0 +1,31 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2014--2021 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/> +-- + +-- Everything in one big transaction +BEGIN; + +SELECT _v.unregister_patch('merchant-0002'); + + +-- Drops for 0002.sql +ALTER TABLE merchant_instances + DROP COLUMN website, + DROP COLUMN email, + DROP COLUMN logo; + + +-- And we're out of here... +COMMIT; diff --git a/src/backenddb/merchant-0002.sql b/src/backenddb/merchant-0002.sql index 87ccd220..5eacaa0b 100644 --- a/src/backenddb/merchant-0002.sql +++ b/src/backenddb/merchant-0002.sql @@ -18,7 +18,19 @@ BEGIN; -- Check patch versioning is in place. --- SELECT _v.register_patch('merchant-0002', NULL, NULL); +SELECT _v.register_patch('merchant-0002', NULL, NULL); + +ALTER TABLE merchant_instances + ADD COLUMN website VARCHAR, + ADD COLUMN email VARCHAR, + ADD COLUMN logo BYTEA; + +COMMENT ON COLUMN merchant_instances.website + IS 'merchant site URL'; +COMMENT ON COLUMN merchant_instances.email + IS 'email'; +COMMENT ON COLUMN merchant_instances.logo + IS 'data image url'; -- Complete transaction COMMIT; diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 8a86c2a0..87049d9e 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -579,6 +579,18 @@ lookup_instances_cb (void *cls, &lic->is.default_wire_transfer_delay), GNUNET_PQ_result_spec_relative_time ("default_pay_delay", &lic->is.default_pay_delay), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("website", + &lic->is.website), + NULL), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("email", + &lic->is.email), + NULL), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("logo", + &lic->is.logo), + NULL), GNUNET_PQ_result_spec_end }; struct GNUNET_PQ_QueryParam params[] = { @@ -767,6 +779,15 @@ postgres_insert_instance ( GNUNET_PQ_query_param_relative_time ( &is->default_wire_transfer_delay), GNUNET_PQ_query_param_relative_time (&is->default_pay_delay), + (NULL == is->website) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->website), + (NULL == is->email) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->email), + (NULL == is->logo) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->logo), GNUNET_PQ_query_param_end }; struct GNUNET_PQ_QueryParam params_priv[] = { @@ -1107,6 +1128,15 @@ postgres_update_instance (void *cls, GNUNET_PQ_query_param_relative_time ( &is->default_wire_transfer_delay), GNUNET_PQ_query_param_relative_time (&is->default_pay_delay), + (NULL == is->website) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->website), + (NULL == is->email) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->email), + (NULL == is->logo) + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (is->logo), GNUNET_PQ_query_param_end }; @@ -6816,6 +6846,9 @@ postgres_connect (void *cls) ",default_wire_fee_amortization" ",default_wire_transfer_delay" ",default_pay_delay" + ",website" + ",email" + ",logo" " FROM merchant_instances", 0), /* for postgres_lookup_instance() */ @@ -6836,6 +6869,9 @@ postgres_connect (void *cls) ",default_wire_fee_amortization" ",default_wire_transfer_delay" ",default_pay_delay" + ",website" + ",email" + ",logo" " FROM merchant_instances" " WHERE merchant_id=$1", 1), @@ -6855,9 +6891,12 @@ postgres_connect (void *cls) ",default_max_wire_fee_frac" ",default_wire_fee_amortization" ",default_wire_transfer_delay" - ",default_pay_delay)" + ",default_pay_delay" + ",website" + ",email" + ",logo)" "VALUES" - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)", + "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)", 14), /* for postgres_insert_instance() */ GNUNET_PQ_make_prepare ("insert_keys", @@ -6945,6 +6984,9 @@ postgres_connect (void *cls) ",default_wire_fee_amortization=$9" ",default_wire_transfer_delay=$10" ",default_pay_delay=$11" + ",website=$12" + ",email=$13" + ",logo=$14" " WHERE merchant_id = $1", 11), /* for postgres_update_instance_auth() */ |