summaryrefslogtreecommitdiff
path: root/src/stasis
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-07-26 00:52:33 +0200
committerChristian Grothoff <grothoff@gnunet.org>2022-07-26 00:52:33 +0200
commitb5d7276460eccf6b05daba9ab77743819ed22859 (patch)
tree24905211290d0829d0d3fbd6b3288b0aba09d9dc /src/stasis
parent8fd36a4defb96770ccc7f3f1fca689a0c433f149 (diff)
downloadanastasis-b5d7276460eccf6b05daba9ab77743819ed22859.tar.gz
anastasis-b5d7276460eccf6b05daba9ab77743819ed22859.tar.bz2
anastasis-b5d7276460eccf6b05daba9ab77743819ed22859.zip
move anastasis DB into schema anastasis
Diffstat (limited to 'src/stasis')
-rw-r--r--src/stasis/drop.sql17
-rw-r--r--src/stasis/plugin_anastasis_postgres.c12
-rw-r--r--src/stasis/stasis-0001.sql5
3 files changed, 17 insertions, 17 deletions
diff --git a/src/stasis/drop.sql b/src/stasis/drop.sql
index c7697c0..67aa4a1 100644
--- 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
index 7ba6b73..566b81a 100644
--- 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
index fe0ab63..cca8245 100644
--- 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),