summaryrefslogtreecommitdiff
path: root/src/auditordb
diff options
context:
space:
mode:
authorNic <nic@eigel.ch>2023-11-02 23:48:08 +0100
committerNic <nic@eigel.ch>2023-11-02 23:48:08 +0100
commit0442c22857a83eb9291182a1a4d372f1ffb9203c (patch)
tree5c6f9ae6a39fb57a3022f650625d899be8141cff /src/auditordb
parentf5cad7636211c03cf4c023df4e9275d603cd1770 (diff)
downloadexchange-0442c22857a83eb9291182a1a4d372f1ffb9203c.tar.gz
exchange-0442c22857a83eb9291182a1a4d372f1ffb9203c.tar.bz2
exchange-0442c22857a83eb9291182a1a4d372f1ffb9203c.zip
-fix 0002-auditordb-scripts
Diffstat (limited to 'src/auditordb')
-rw-r--r--src/auditordb/0002-auditor_balances.sql20
-rw-r--r--src/auditordb/0002-auditor_denomination_pending.sql1
-rw-r--r--src/auditordb/0002-auditor_historic_denomination_revenue.sql1
-rw-r--r--src/auditordb/0002-auditor_historic_reserve_summary.sql1
-rw-r--r--src/auditordb/0002-auditor_purses.sql3
-rw-r--r--src/auditordb/0002-auditor_reserves.sql1
-rw-r--r--src/auditordb/0002-deposit_confirmations.sql1
-rw-r--r--src/auditordb/auditor-0002.sql.in19
8 files changed, 32 insertions, 15 deletions
diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql
index 396381e0b..5a25a0e2a 100644
--- 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
index ea47dc0da..0dee6ecab 100644
--- 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
index 98146aae7..19c0b5829 100644
--- 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
index e71ae8b7a..819c4e160 100644
--- 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
index 9ba5955eb..17fd5dde2 100644
--- 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
index 834d245ef..1ed56be61 100644
--- 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
index 1d63bdb6e..e246e131d 100644
--- 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
index ab0db2fb8..3d07433ea 100644
--- 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"