diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-01-17 10:59:04 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-01-17 11:00:59 +0100 |
commit | a79a561cc4696ff166d77e74aa33ca8b3269e0a0 (patch) | |
tree | 7cb7014bca04e5b67c6777fd5b15dd7133400824 /src | |
parent | c402b024d864abc9d918cb1eb2ae3886963bcc8c (diff) | |
download | sync-a79a561cc4696ff166d77e74aa33ca8b3269e0a0.tar.gz sync-a79a561cc4696ff166d77e74aa33ca8b3269e0a0.tar.bz2 sync-a79a561cc4696ff166d77e74aa33ca8b3269e0a0.zip |
use sync schema
Diffstat (limited to 'src')
-rw-r--r-- | src/syncdb/drop.sql | 13 | ||||
-rw-r--r-- | src/syncdb/plugin_syncdb_postgres.c | 14 | ||||
-rw-r--r-- | 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); |