summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql5
-rw-r--r--src/auditordb/0002-auditor_balances.sql1
-rw-r--r--src/auditordb/0002-auditor_denomination_pending.sql3
-rw-r--r--src/auditordb/0002-auditor_deposit_confirmations.sql6
-rw-r--r--src/auditordb/0002-auditor_exchange_signkeys.sql3
-rw-r--r--src/auditordb/0002-auditor_historic_denomination_revenue.sql3
-rw-r--r--src/auditordb/0002-auditor_purses.sql3
-rw-r--r--src/auditordb/0002-auditor_reserves.sql3
-rw-r--r--src/auditordb/auditor-0002.sql.in6
-rw-r--r--src/auditordb/drop.sql4
-rw-r--r--src/auditordb/restart.sql1
11 files changed, 12 insertions, 26 deletions
diff --git a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql
index 712561ccc..19dfa682c 100644
--- a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql
+++ b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql
@@ -14,8 +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_amount_arithmetic_inconsistency
+CREATE TABLE auditor_amount_arithmetic_inconsistency
(
row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
operation BYTEA,
@@ -24,4 +23,4 @@ CREATE TABLE IF NOT EXISTS auditor_amount_arithmetic_inconsistency
profitable BOOLEAN
);
COMMENT ON TABLE auditor_amount_arithmetic_inconsistency
- IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts'; \ No newline at end of file
+ IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts';
diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql
index a52edbcd0..8014b9c41 100644
--- a/src/auditordb/0002-auditor_balances.sql
+++ b/src/auditordb/0002-auditor_balances.sql
@@ -14,7 +14,6 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-SET search_path TO auditor;
CREATE TABLE IF NOT EXISTS auditor_balances
(
balance_key TEXT PRIMARY KEY NOT NULL
diff --git a/src/auditordb/0002-auditor_denomination_pending.sql b/src/auditordb/0002-auditor_denomination_pending.sql
index 0dee6ecab..f9ba535b4 100644
--- a/src/auditordb/0002-auditor_denomination_pending.sql
+++ b/src/auditordb/0002-auditor_denomination_pending.sql
@@ -14,8 +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
+CREATE TABLE auditor_denomination_pending
(denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
,denom_balance taler_amount NOT NULL
,denom_loss taler_amount NOT NULL
diff --git a/src/auditordb/0002-auditor_deposit_confirmations.sql b/src/auditordb/0002-auditor_deposit_confirmations.sql
index e26009efc..1b7fec185 100644
--- a/src/auditordb/0002-auditor_deposit_confirmations.sql
+++ b/src/auditordb/0002-auditor_deposit_confirmations.sql
@@ -14,9 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-SET search_path TO auditor;
-DROP TABLE IF EXISTS deposit_confirmations;
-CREATE TABLE IF NOT EXISTS auditor_deposit_confirmations
+CREATE TABLE auditor_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)
,h_policy BYTEA NOT NULL CHECK (LENGTH(h_policy)=64)
@@ -57,4 +55,4 @@ COMMENT ON FUNCTION auditor_new_transactions_trigger()
CREATE TRIGGER auditor_notify_helper_deposits
AFTER INSERT
ON auditor.auditor_deposit_confirmations
-EXECUTE PROCEDURE auditor_new_transactions_trigger(); \ No newline at end of file
+EXECUTE PROCEDURE auditor_new_transactions_trigger();
diff --git a/src/auditordb/0002-auditor_exchange_signkeys.sql b/src/auditordb/0002-auditor_exchange_signkeys.sql
index 345870252..64349a2ff 100644
--- a/src/auditordb/0002-auditor_exchange_signkeys.sql
+++ b/src/auditordb/0002-auditor_exchange_signkeys.sql
@@ -14,8 +14,7 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-DROP TABLE IF EXISTS auditor_exchange_signkeys;
-CREATE TABLE IF NOT EXISTS auditor_exchange_signkeys
+CREATE TABLE auditor_exchange_signkeys
(exchange_pub BYTEA PRIMARY KEY CHECK (LENGTH(exchange_pub)=32)
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
,ep_valid_from INT8 NOT NULL
diff --git a/src/auditordb/0002-auditor_historic_denomination_revenue.sql b/src/auditordb/0002-auditor_historic_denomination_revenue.sql
index 19c0b5829..bf7e4c07e 100644
--- a/src/auditordb/0002-auditor_historic_denomination_revenue.sql
+++ b/src/auditordb/0002-auditor_historic_denomination_revenue.sql
@@ -14,8 +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
+CREATE TABLE auditor_historic_denomination_revenue
(denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
,revenue_timestamp INT8 NOT NULL
,revenue_balance taler_amount NOT NULL
diff --git a/src/auditordb/0002-auditor_purses.sql b/src/auditordb/0002-auditor_purses.sql
index 7cebd8894..86b6494d1 100644
--- a/src/auditordb/0002-auditor_purses.sql
+++ b/src/auditordb/0002-auditor_purses.sql
@@ -14,8 +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
+CREATE TABLE auditor_purses
(auditor_purses_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
,purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)
,balance taler_amount NOT NULL DEFAULT(0,0)
diff --git a/src/auditordb/0002-auditor_reserves.sql b/src/auditordb/0002-auditor_reserves.sql
index 1ed56be61..808524b28 100644
--- a/src/auditordb/0002-auditor_reserves.sql
+++ b/src/auditordb/0002-auditor_reserves.sql
@@ -14,8 +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
+CREATE TABLE auditor_reserves
(auditor_reserves_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)
,reserve_balance taler_amount NOT NULL
diff --git a/src/auditordb/auditor-0002.sql.in b/src/auditordb/auditor-0002.sql.in
index ac0dd33d4..ad459b472 100644
--- a/src/auditordb/auditor-0002.sql.in
+++ b/src/auditordb/auditor-0002.sql.in
@@ -16,12 +16,8 @@
BEGIN;
--- move later into auditor-0001.sql
-CREATE SCHEMA IF NOT EXISTS auditor;
-COMMENT ON SCHEMA auditor IS 'taler-auditor data';
-
-
SELECT _v.register_patch('auditor-0002', NULL, NULL);
+
SET search_path TO auditor;
DO $$ BEGIN
diff --git a/src/auditordb/drop.sql b/src/auditordb/drop.sql
index 3dff35ec5..20bc192c0 100644
--- a/src/auditordb/drop.sql
+++ b/src/auditordb/drop.sql
@@ -17,10 +17,8 @@
-- Everything in one big transaction
BEGIN;
-
--- Drop versioning (auditor-0001.sql)
SELECT _v.unregister_patch('auditor-0001');
--- SELECT _v.unregister_patch('auditor-0002');
+SELECT _v.unregister_patch('auditor-0002');
DROP SCHEMA auditor CASCADE;
-- And we're out of here...
diff --git a/src/auditordb/restart.sql b/src/auditordb/restart.sql
index 090c86b53..2dc6864ff 100644
--- a/src/auditordb/restart.sql
+++ b/src/auditordb/restart.sql
@@ -31,6 +31,7 @@ SET search_path TO auditor;
-- Unlike the other SQL files, it SHOULD be updated to reflect the
-- latest requirements for dropping tables.
+DELETE FROM auditor_amount_arithmetic_inconsistency;
DELETE FROM auditor_balances;
DELETE FROM auditor_denomination_pending;
DELETE FROM auditor_historic_denomination_revenue;