commit 8cdd76860d5b130ee4e001946a2702488f2be196
parent ca00a4a2ee4a06395f9df2d9359952f6d90081cc
Author: Antoine A <>
Date: Fri, 19 Jul 2024 13:05:20 +0200
bank: make customer name not null in sql schema
Diffstat:
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/database-versioning/libeufin-bank-0007.sql b/database-versioning/libeufin-bank-0007.sql
@@ -0,0 +1,27 @@
+--
+-- 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('libeufin-bank-0007', NULL, NULL);
+SET search_path TO libeufin_bank;
+
+-- Make customer not null
+
+-- Fill missing name with an empty string. All accounts created using the API already
+-- have a non-null name, so this only applies to accounts created manually with SQL.
+UPDATE customers SET name='' WHERE name is NULL;
+ALTER TABLE customers ALTER COLUMN name SET NOT NULL;
+COMMIT;
diff --git a/testbench/src/test/kotlin/MigrationTest.kt b/testbench/src/test/kotlin/MigrationTest.kt
@@ -59,6 +59,18 @@ class MigrationTest {
// libeufin-bank-0003
conn.execSQLUpdate(Path("../database-versioning/libeufin-bank-0003.sql").readText())
+ // libeufin-bank-0004
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-bank-0004.sql").readText())
+
+ // libeufin-bank-0005
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-bank-0005.sql").readText())
+
+ // libeufin-bank-0006
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-bank-0006.sql").readText())
+
+ // libeufin-bank-0007
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-bank-0007.sql").readText())
+
// libeufin-nexus-0001
conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0001.sql").readText())
conn.execSQLUpdate("""
@@ -70,5 +82,14 @@ class MigrationTest {
// libeufin-nexus-0002
conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0002.sql").readText())
+
+ // libeufin-nexus-0003
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0003.sql").readText())
+
+ // libeufin-nexus-0004
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0004.sql").readText())
+
+ // libeufin-nexus-0005
+ conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0005.sql").readText())
}
}
\ No newline at end of file