move auditor database also into schema

This commit is contained in:
Christian Grothoff 2022-07-25 22:49:59 +02:00
parent 6d2e6d8061
commit d2ec1bf3cf
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 23 additions and 29 deletions

View File

@ -21,6 +21,12 @@ BEGIN;
SELECT _v.register_patch('auditor-0001', NULL, NULL);
CREATE SCHEMA auditor;
COMMENT ON SCHEMA auditor IS 'taler-auditor data';
SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_exchanges
(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)
,exchange_url VARCHAR NOT NULL

View File

@ -17,34 +17,10 @@
-- Everything in one big transaction
BEGIN;
-- This script DROPs all of the tables we create, including the
-- versioning schema!
--
-- 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 auditor_predicted_result;
DROP TABLE IF EXISTS auditor_historic_denomination_revenue;
DROP TABLE IF EXISTS auditor_balance_summary;
DROP TABLE IF EXISTS auditor_denomination_pending;
DROP TABLE IF EXISTS auditor_reserve_balance;
DROP TABLE IF EXISTS auditor_wire_fee_balance;
DROP TABLE IF EXISTS auditor_reserves;
DROP TABLE IF EXISTS auditor_progress_reserve;
DROP TABLE IF EXISTS auditor_progress_aggregation;
DROP TABLE IF EXISTS auditor_progress_deposit_confirmation;
DROP TABLE IF EXISTS auditor_progress_coin;
DROP TABLE IF EXISTS auditor_exchange_signkeys;
DROP TABLE IF EXISTS wire_auditor_progress;
DROP TABLE IF EXISTS wire_auditor_account_progress;
DROP TABLE IF EXISTS auditor_historic_reserve_summary CASCADE;
DROP TABLE IF EXISTS auditor_denominations CASCADE;
DROP TABLE IF EXISTS deposit_confirmations CASCADE;
DROP TABLE IF EXISTS auditor_exchanges CASCADE;
-- Drop versioning (auditor-0001.sql)
SELECT _v.unregister_patch('auditor-0001');
DROP SCHEMA auditor CASCADE;
-- And we're out of here...
COMMIT;

View File

@ -1,6 +1,6 @@
/*
This file is part of TALER
Copyright (C) 2014-2021 Taler Systems SA
Copyright (C) 2014-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
@ -128,11 +128,15 @@ postgres_create_tables (void *cls)
{
struct PostgresClosure *pc = cls;
struct GNUNET_PQ_Context *conn;
struct GNUNET_PQ_ExecuteStatement es[] = {
GNUNET_PQ_make_try_execute ("SET search_path TO auditor;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
conn = GNUNET_PQ_connect_with_cfg (pc->cfg,
"auditordb-postgres",
"auditor-",
NULL,
es,
NULL);
if (NULL == conn)
return GNUNET_SYSERR;
@ -685,6 +689,10 @@ setup_connection (struct PostgresClosure *pg)
1),
GNUNET_PQ_PREPARED_STATEMENT_END
};
struct GNUNET_PQ_ExecuteStatement es[] = {
GNUNET_PQ_make_try_execute ("SET search_path TO auditor;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
struct GNUNET_PQ_Context *db_conn;
if (NULL != pg->conn)
@ -695,7 +703,7 @@ setup_connection (struct PostgresClosure *pg)
db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
"auditordb-postgres",
NULL,
NULL,
es,
ps);
if (NULL == db_conn)
return GNUNET_SYSERR;
@ -847,12 +855,16 @@ postgres_gc (void *cls)
#endif
GNUNET_PQ_PREPARED_STATEMENT_END
};
struct GNUNET_PQ_ExecuteStatement es[] = {
GNUNET_PQ_make_try_execute ("SET search_path TO auditor;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
now = GNUNET_TIME_absolute_get ();
conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
"auditordb-postgres",
NULL,
NULL,
es,
ps);
if (NULL == conn)
return GNUNET_SYSERR;