summaryrefslogtreecommitdiff
path: root/src/exchangedb/exchange-0001-part.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/exchange-0001-part.sql')
-rw-r--r--src/exchangedb/exchange-0001-part.sql176
1 files changed, 0 insertions, 176 deletions
diff --git a/src/exchangedb/exchange-0001-part.sql b/src/exchangedb/exchange-0001-part.sql
index 29412ca75..85f6c3e76 100644
--- a/src/exchangedb/exchange-0001-part.sql
+++ b/src/exchangedb/exchange-0001-part.sql
@@ -14,182 +14,6 @@
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
--
-
--- ------------------------------ aggregation_transient ----------------------------------------
-
-SELECT create_table_aggregation_transient();
-
-COMMENT ON TABLE aggregation_transient
- IS 'aggregations currently happening (lacking wire_out, usually because the amount is too low); this table is not replicated';
-COMMENT ON COLUMN aggregation_transient.amount_val
- IS 'Sum of all of the aggregated deposits (without deposit fees)';
-COMMENT ON COLUMN aggregation_transient.wtid_raw
- IS 'identifier of the wire transfer';
-
--- ------------------------------ aggregation_tracking ----------------------------------------
-
-SELECT create_table_aggregation_tracking();
-
-COMMENT ON TABLE aggregation_tracking
- IS 'mapping from wire transfer identifiers (WTID) to deposits (and back)';
-COMMENT ON COLUMN aggregation_tracking.wtid_raw
- IS 'identifier of the wire transfer';
-
-SELECT add_constraints_to_aggregation_tracking_partition('default');
-
-
--- ------------------------------ recoup ----------------------------------------
-
-SELECT create_table_recoup();
-
-COMMENT ON TABLE recoup
- IS 'Information about recoups that were executed between a coin and a reserve. In this type of recoup, the amount is credited back to the reserve from which the coin originated.';
-COMMENT ON COLUMN recoup.coin_pub
- IS 'Coin that is being debited in the recoup. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
-COMMENT ON COLUMN recoup.reserve_out_serial_id
- IS 'Identifies the h_blind_ev of the recouped coin and provides the link to the credited reserve.';
-COMMENT ON COLUMN recoup.coin_sig
- IS 'Signature by the coin affirming the recoup, of type TALER_SIGNATURE_WALLET_COIN_RECOUP';
-COMMENT ON COLUMN recoup.coin_blind
- IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the withdraw operation.';
-
-SELECT add_constraints_to_recoup_partition('default');
-
-
-SELECT create_table_recoup_by_reserve();
-
-COMMENT ON TABLE recoup_by_reserve
- IS 'Information in this table is strictly redundant with that of recoup, but saved by a different primary key for fast lookups by reserve_out_serial_id.';
-
-CREATE OR REPLACE FUNCTION recoup_insert_trigger()
- RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- INSERT INTO exchange.recoup_by_reserve
- (reserve_out_serial_id
- ,coin_pub)
- VALUES
- (NEW.reserve_out_serial_id
- ,NEW.coin_pub);
- RETURN NEW;
-END $$;
-COMMENT ON FUNCTION recoup_insert_trigger()
- IS 'Replicate recoup inserts into recoup_by_reserve table.';
-
-CREATE TRIGGER recoup_on_insert
- AFTER INSERT
- ON recoup
- FOR EACH ROW EXECUTE FUNCTION recoup_insert_trigger();
-
-CREATE OR REPLACE FUNCTION recoup_delete_trigger()
- RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- DELETE FROM exchange.recoup_by_reserve
- WHERE reserve_out_serial_id = OLD.reserve_out_serial_id
- AND coin_pub = OLD.coin_pub;
- RETURN OLD;
-END $$;
-COMMENT ON FUNCTION recoup_delete_trigger()
- IS 'Replicate recoup deletions into recoup_by_reserve table.';
-
-CREATE TRIGGER recoup_on_delete
- AFTER DELETE
- ON recoup
- FOR EACH ROW EXECUTE FUNCTION recoup_delete_trigger();
-
-
--- ------------------------------ recoup_refresh ----------------------------------------
-
-SELECT create_table_recoup_refresh();
-
-COMMENT ON TABLE recoup_refresh
- IS 'Table of coins that originated from a refresh operation and that were recouped. Links the (fresh) coin to the melted operation (and thus the old coin). A recoup on a refreshed coin credits the old coin and debits the fresh coin.';
-COMMENT ON COLUMN recoup_refresh.coin_pub
- IS 'Refreshed coin of a revoked denomination where the residual value is credited to the old coin. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
-COMMENT ON COLUMN recoup_refresh.known_coin_id
- IS 'FIXME: (To be) used for garbage collection (in the future)';
-COMMENT ON COLUMN recoup_refresh.rrc_serial
- IS 'Link to the refresh operation. Also identifies the h_blind_ev of the recouped coin (as h_coin_ev).';
-COMMENT ON COLUMN recoup_refresh.coin_blind
- IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the refresh operation.';
-
-SELECT add_constraints_to_recoup_refresh_partition('default');
-
-
--- ------------------------------ prewire ----------------------------------------
-
-SELECT create_table_prewire();
-
-COMMENT ON TABLE prewire
- IS 'pre-commit data for wire transfers we are about to execute';
-COMMENT ON COLUMN prewire.failed
- IS 'set to TRUE if the bank responded with a non-transient failure to our transfer request';
-COMMENT ON COLUMN prewire.finished
- IS 'set to TRUE once bank confirmed receiving the wire transfer request';
-COMMENT ON COLUMN prewire.buf
- IS 'serialized data to send to the bank to execute the wire transfer';
-
--- ------------------------------ cs_nonce_locks ----------------------------------------
-
-SELECT create_table_cs_nonce_locks();
-
-COMMENT ON TABLE cs_nonce_locks
- IS 'ensures a Clause Schnorr client nonce is locked for use with an operation identified by a hash';
-COMMENT ON COLUMN cs_nonce_locks.nonce
- IS 'actual nonce submitted by the client';
-COMMENT ON COLUMN cs_nonce_locks.op_hash
- IS 'hash (RC for refresh, blind coin hash for withdraw) the nonce may be used with';
-COMMENT ON COLUMN cs_nonce_locks.max_denomination_serial
- IS 'Maximum number of a CS denomination serial the nonce could be used with, for GC';
-
-SELECT add_constraints_to_cs_nonce_locks_partition('default');
-
-
--- ------------------------------ purse_requests ----------------------------------------
-
-SELECT create_table_purse_requests();
-
-COMMENT ON TABLE purse_requests
- IS 'Requests establishing purses, associating them with a contract but without a target reserve';
-COMMENT ON COLUMN purse_requests.purse_pub
- IS 'Public key of the purse';
-COMMENT ON COLUMN purse_requests.purse_creation
- IS 'Local time when the purse was created. Determines applicable purse fees.';
-COMMENT ON COLUMN purse_requests.purse_expiration
- IS 'When the purse is set to expire';
-COMMENT ON COLUMN purse_requests.h_contract_terms
- IS 'Hash of the contract the parties are to agree to';
-COMMENT ON COLUMN purse_requests.flags
- IS 'see the enum TALER_WalletAccountMergeFlags';
-COMMENT ON COLUMN purse_requests.in_reserve_quota
- IS 'set to TRUE if this purse currently counts against the number of free purses in the respective reserve';
-COMMENT ON COLUMN purse_requests.amount_with_fee_val
- IS 'Total amount expected to be in the purse';
-COMMENT ON COLUMN purse_requests.purse_fee_val
- IS 'Purse fee the client agreed to pay from the reserve (accepted by the exchange at the time the purse was created). Zero if in_reserve_quota is TRUE.';
-COMMENT ON COLUMN purse_requests.balance_val
- IS 'Total amount actually in the purse';
-COMMENT ON COLUMN purse_requests.purse_sig
- IS 'Signature of the purse affirming the purse parameters, of type TALER_SIGNATURE_PURSE_REQUEST';
-
-SELECT add_constraints_to_purse_requests_partition('default');
-
-
--- ------------------------------ purse_decisions ----------------------------------------
-
-SELECT create_table_purse_decision();
-
-COMMENT ON TABLE purse_decision
- IS 'Purses that were decided upon (refund or merge)';
-COMMENT ON COLUMN purse_decision.purse_pub
- IS 'Public key of the purse';
-
-SELECT add_constraints_to_purse_decision_partition('default');
-
-
-- ------------------------------ purse_merges ----------------------------------------
SELECT create_table_purse_merges();