commit 0442c22857a83eb9291182a1a4d372f1ffb9203c
parent f5cad7636211c03cf4c023df4e9275d603cd1770
Author: Nic <nic@eigel.ch>
Date: Thu, 2 Nov 2023 23:48:08 +0100
-fix 0002-auditordb-scripts
Diffstat:
8 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql
@@ -14,13 +14,19 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-CREATE TABLE IF NOT EXISTS auditor_balances (
- balance_key TEXT PRIMARY KEY
- ,balance_value taler_amount
- );
-COMMENT ON TABLE auditor_balances
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_balances
+(
+ balance_key TEXT
+ ,balance_value taler_amount
+ ,PRIMARY KEY (balance_key)
+);
+COMMENT
+ON TABLE auditor_balances
IS 'table storing various global balances of the auditor';
-COMMENT ON COLUMN auditor_balances.balance_key
+COMMENT
+ON COLUMN auditor_balances.balance_key
IS 'unique name for the balance value';
-COMMENT ON COLUMN auditor_balances.balance_value
+COMMENT
+ON COLUMN auditor_balances.balance_value
IS 'balance amount';
diff --git a/src/auditordb/0002-auditor_denomination_pending.sql b/src/auditordb/0002-auditor_denomination_pending.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_denomination_pending
(denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
,denom_balance taler_amount NOT NULL
diff --git a/src/auditordb/0002-auditor_historic_denomination_revenue.sql b/src/auditordb/0002-auditor_historic_denomination_revenue.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_historic_denomination_revenue
(denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
,revenue_timestamp INT8 NOT NULL
diff --git a/src/auditordb/0002-auditor_historic_reserve_summary.sql b/src/auditordb/0002-auditor_historic_reserve_summary.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_historic_reserve_summary
(start_date INT8 PRIMARY KEY
,end_date INT8 NOT NULL
diff --git a/src/auditordb/0002-auditor_purses.sql b/src/auditordb/0002-auditor_purses.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_purses
(auditor_purses_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
,purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)
@@ -21,5 +22,5 @@ CREATE TABLE IF NOT EXISTS auditor_purses
,target taler_amount NOT NULL
,expiration_date INT8 NOT NULL
);
-COMMENT ON TABLE purses
+COMMENT ON TABLE auditor_purses
IS 'all of the purses and their respective balances that the auditor is aware of';
diff --git a/src/auditordb/0002-auditor_reserves.sql b/src/auditordb/0002-auditor_reserves.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_reserves
(auditor_reserves_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)
diff --git a/src/auditordb/0002-deposit_confirmations.sql b/src/auditordb/0002-deposit_confirmations.sql
@@ -14,6 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
+SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS deposit_confirmations
(deposit_confirmation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
diff --git a/src/auditordb/auditor-0002.sql.in b/src/auditordb/auditor-0002.sql.in
@@ -24,13 +24,18 @@ COMMENT ON SCHEMA auditor IS 'taler-auditor data';
SELECT _v.register_patch('auditor-0002', NULL, NULL);
SET search_path TO auditor;
-CREATE TYPE taler_amount
- AS
- (val INT8
- ,frac INT4
- );
-COMMENT ON TYPE taler_amount
- IS 'Stores an amount, fraction is in units of 1/100000000 of the base value';
+DO $$ BEGIN
+ CREATE TYPE taler_amount
+ AS
+ (val INT8
+ ,frac INT4
+ );
+ COMMENT ON TYPE taler_amount
+ IS 'Stores an amount, fraction is in units of 1/100000000 of the base value';
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+
#include "0002-auditor_balances.sql"
#include "0002-auditor_denomination_pending.sql"