anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit b5d7276460eccf6b05daba9ab77743819ed22859
parent 8fd36a4defb96770ccc7f3f1fca689a0c433f149
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Tue, 26 Jul 2022 00:52:33 +0200

move anastasis DB into schema anastasis

Diffstat:
Msrc/stasis/drop.sql | 17++---------------
Msrc/stasis/plugin_anastasis_postgres.c | 12++++++++++--
Msrc/stasis/stasis-0001.sql | 5+++++
3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/stasis/drop.sql b/src/stasis/drop.sql @@ -1,6 +1,6 @@ -- -- This file is part of ANASTASIS --- Copyright (C) 2014--2020 Anastasis Systems SA +-- Copyright (C) 2014--2022 Anastasis Systems SA -- -- ANASTASIS 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 @@ -17,22 +17,9 @@ -- Everything in one big transaction BEGIN; --- This script DROPs all of the tables we create. --- --- Unlike the other SQL files, it SHOULD be updated to reflect the --- latest requirements for dropping tables. - --- Drops for 0001.sql -DROP TABLE IF EXISTS anastasis_truth CASCADE; -DROP TABLE IF EXISTS anastasis_user CASCADE; -DROP TABLE IF EXISTS anastasis_recdoc_payment; -DROP TABLE IF EXISTS anastasis_recoverydocument; -DROP TABLE IF EXISTS anastasis_challengecode; -DROP TABLE IF EXISTS anastasis_challenge_payment; -DROP TABLE IF EXISTS anastasis_auth_iban_in; - -- Unregister patch (0001.sql) SELECT _v.unregister_patch('stasis-0001'); +DROP SCHEMA anastasis CASCADE; -- And we're out of here... COMMIT; diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c @@ -110,11 +110,15 @@ postgres_create_tables (void *cls) { struct PostgresClosure *pc = cls; struct GNUNET_PQ_Context *conn; + struct GNUNET_PQ_ExecuteStatement es[] = { + GNUNET_PQ_make_execute ("SET search_path TO anastasis;"), + GNUNET_PQ_EXECUTE_STATEMENT_END + }; conn = GNUNET_PQ_connect_with_cfg (pc->cfg, "stasis-postgres", "stasis-", - NULL, + es, NULL); if (NULL == conn) return GNUNET_SYSERR; @@ -562,10 +566,14 @@ internal_setup (struct PostgresClosure *pg, "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE;"), GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"), GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"), + GNUNET_PQ_make_execute ("SET search_path TO anastasis;"), GNUNET_PQ_EXECUTE_STATEMENT_END }; #else - struct GNUNET_PQ_ExecuteStatement *es = NULL; + struct GNUNET_PQ_ExecuteStatement es[] = { + GNUNET_PQ_make_execute ("SET search_path TO anastasis;"), + GNUNET_PQ_EXECUTE_STATEMENT_END + }; #endif struct GNUNET_PQ_Context *db_conn; diff --git a/src/stasis/stasis-0001.sql b/src/stasis/stasis-0001.sql @@ -20,6 +20,11 @@ BEGIN; -- Check patch versioning is in place. SELECT _v.register_patch('stasis-0001', NULL, NULL); +CREATE SCHEMA anastasis; +COMMENT ON SCHEMA anastasis IS 'anastasis backend data'; + +SET search_path TO anastasis; + CREATE TABLE IF NOT EXISTS anastasis_truth_payment (truth_uuid BYTEA PRIMARY KEY CHECK(LENGTH(truth_uuid)=32),