exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 71876a14450a058006b3eaf70f8cf91992f82f04
parent adf38ac21ec3eaef9028bcf8e89fd84e747bb277
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 19 Dec 2025 17:08:04 +0100

fix up NULL entries in wire_targets to ensure v1.0 migration runs nicely

Diffstat:
Msrc/exchangedb/exchange-0006.sql | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/exchangedb/exchange-0006.sql b/src/exchangedb/exchange-0006.sql @@ -27,6 +27,7 @@ DECLARE my_rec RECORD; my_payto TEXT; my_is_wallet BOOL; + my_setup_extension BOOL; wtc CURSOR FOR SELECT h_normalized_payto @@ -34,6 +35,17 @@ DECLARE FROM exchange.wire_targets; BEGIN +-- Fix any remaining NULL columns in wire_targets +CREATE EXTENSION pgcrypto IF NOT EXISTS pgcrypto; +my_setup_extension = FOUND; +UPDATE wire_targets + SET h_normalized_payto=substring(digest(convert_to(payto_uri, 'UTF8') || E'\\000'::bytea, 'sha512') FROM 1 FOR 32) + WHERE h_normalized_payto IS NULL; +IF my_setup_extension +THEN + DROP EXTENSION pgcrypto; +END IF; + -- Only run the migration if the tables already exist. PERFORM FROM pg_tables