summaryrefslogtreecommitdiff
path: root/src/auditordb/0002-auditor_historic_denomination_revenue.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-09-26 11:25:31 +0200
committerChristian Grothoff <christian@grothoff.org>2023-09-26 11:25:31 +0200
commit4f255d799a1f9b14e8491a76a9be99dfa44e4385 (patch)
tree110861827ee16975f297b8dd05803f8c6fa53993 /src/auditordb/0002-auditor_historic_denomination_revenue.sql
parentc89c7eff4945dd56887530705841ef648427b35d (diff)
downloadexchange-4f255d799a1f9b14e8491a76a9be99dfa44e4385.tar.gz
exchange-4f255d799a1f9b14e8491a76a9be99dfa44e4385.tar.bz2
exchange-4f255d799a1f9b14e8491a76a9be99dfa44e4385.zip
-first hack at SQL fixes
Diffstat (limited to 'src/auditordb/0002-auditor_historic_denomination_revenue.sql')
-rw-r--r--src/auditordb/0002-auditor_historic_denomination_revenue.sql22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/auditordb/0002-auditor_historic_denomination_revenue.sql b/src/auditordb/0002-auditor_historic_denomination_revenue.sql
index ac8b9c9fc..98146aae7 100644
--- a/src/auditordb/0002-auditor_historic_denomination_revenue.sql
+++ b/src/auditordb/0002-auditor_historic_denomination_revenue.sql
@@ -15,14 +15,18 @@
--
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
- ,revenue_balance_val INT8 NOT NULL
- ,revenue_balance_frac INT4 NOT NULL
- ,loss_balance_val INT8 NOT NULL
- ,loss_balance_frac INT4 NOT NULL
- );
+ (denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
+ ,revenue_timestamp INT8 NOT NULL
+ ,revenue_balance taler_amount NOT NULL
+ ,loss_balance taler_amount NOT NULL
+ );
COMMENT ON TABLE auditor_historic_denomination_revenue
IS 'Table with historic profits; basically, when a denom_pub has expired and everything associated with it is garbage collected, the final profits end up in here; note that the denom_pub here is not a foreign key, we just keep it as a reference point.';
-COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_balance_val
- IS 'the sum of all of the profits we made on the coin except for withdraw fees (which are in historic_reserve_revenue); so this includes the deposit, melt and refund fees';
+COMMENT ON COLUMN auditor_historic_denomination_revenue.denom_pub_hash
+ IS 'hash of the denomination public key that created this revenue';
+COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_timestamp
+ IS 'when was this revenue realized (by the denomination public key expiring)';
+COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_balance
+ IS 'the sum of all of the profits we made on the denomination except for withdraw fees (which are in historic_reserve_revenue); so this includes the deposit, melt and refund fees';
+COMMENT ON COLUMN auditor_historic_denomination_revenue.loss_balance
+ IS 'the sum of all of the losses we made on the denomination (for example, because the signing key was compromised and thus we redeemed coins we never issued); of course should be zero in practice in most cases';