gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-sync] branch master updated: use sync schema


From: gnunet
Subject: [taler-sync] branch master updated: use sync schema
Date: Tue, 17 Jan 2023 11:01:02 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository sync.

The following commit(s) were added to refs/heads/master by this push:
     new a79a561  use sync schema
a79a561 is described below

commit a79a561cc4696ff166d77e74aa33ca8b3269e0a0
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Tue Jan 17 10:59:04 2023 +0100

    use sync schema
---
 src/syncdb/drop.sql                 | 13 ++-----------
 src/syncdb/plugin_syncdb_postgres.c | 14 +++++++++++---
 src/syncdb/sync-0001.sql            |  5 +++++
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/syncdb/drop.sql b/src/syncdb/drop.sql
index 9253517..05d11b4 100644
--- a/src/syncdb/drop.sql
+++ b/src/syncdb/drop.sql
@@ -1,6 +1,6 @@
 --
 -- This file is part of TALER
--- Copyright (C) 2021 Taler Systems SA
+-- Copyright (C) 2021, 2022 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
@@ -17,18 +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 payments CASCADE;
-DROP TABLE IF EXISTS backups CASCADE;
-DROP TABLE IF EXISTS accounts CASCADE;
-
 -- Unregister patch (0001.sql)
 SELECT _v.unregister_patch('sync-0001');
+DROP SCHEMA sync CASCADE;
 
 -- And we're out of here...
 COMMIT;
diff --git a/src/syncdb/plugin_syncdb_postgres.c 
b/src/syncdb/plugin_syncdb_postgres.c
index 85edc60..51c88e4 100644
--- a/src/syncdb/plugin_syncdb_postgres.c
+++ b/src/syncdb/plugin_syncdb_postgres.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  (C) 2014--2021 Taler Systems SA
+  (C) 2014--2022 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU Lesser General Public License as published by the Free 
Software
@@ -259,10 +259,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 sync;"),
       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 sync;"),
+      GNUNET_PQ_EXECUTE_STATEMENT_END
+    };
 #endif
     struct GNUNET_PQ_Context *db_conn;
 
@@ -1258,11 +1262,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 sync;"),
+    GNUNET_PQ_EXECUTE_STATEMENT_END
+  };
 
   conn = GNUNET_PQ_connect_with_cfg (pc->cfg,
                                      "syncdb-postgres",
                                      "sync-",
-                                     NULL,
+                                     es,
                                      NULL);
   if (NULL == conn)
     return GNUNET_SYSERR;
diff --git a/src/syncdb/sync-0001.sql b/src/syncdb/sync-0001.sql
index a463d72..77eb753 100644
--- a/src/syncdb/sync-0001.sql
+++ b/src/syncdb/sync-0001.sql
@@ -20,6 +20,11 @@ BEGIN;
 -- Check patch versioning is in place.
 SELECT _v.register_patch('sync-0001', NULL, NULL);
 
+CREATE SCHEMA sync;
+COMMENT ON SCHEMA sync IS 'sync data';
+
+SET search_path TO sync;
+
 CREATE TABLE IF NOT EXISTS accounts
   (account_pub BYTEA PRIMARY KEY CHECK (length(account_pub)=32)
   ,expiration_date INT8 NOT NULL);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]