summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-10-06 16:30:19 +0200
committerChristian Grothoff <christian@grothoff.org>2016-10-06 16:30:19 +0200
commit03940806003d08994384dc7cfd6f412df1139b35 (patch)
treeb26d2d8817ef2eb0a7caf05f636ef660d1c0ede6 /src/exchangedb
parentb68adb93c6e0bcb225e115cd62e23f1318ef259b (diff)
downloadexchange-03940806003d08994384dc7cfd6f412df1139b35.tar.gz
exchange-03940806003d08994384dc7cfd6f412df1139b35.tar.bz2
exchange-03940806003d08994384dc7cfd6f412df1139b35.zip
first draft for an auditor table structure
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index a90ff849d..7a1c749fc 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -311,7 +311,8 @@ postgres_create_tables (void *cls)
into the reserve. The rows of this table correspond to each
incoming transaction. */
SQLEXEC("CREATE TABLE IF NOT EXISTS reserves_in"
- "(reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
+ "(reserve_in_serial_id BIGSERIAL PRIMARY KEY"
+ ",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
",credit_val INT8 NOT NULL"
",credit_frac INT4 NOT NULL"
",credit_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
@@ -329,7 +330,8 @@ postgres_create_tables (void *cls)
should fail to even withdraw, as otherwise the coins will fail to deposit
(as they really must be unique). */
SQLEXEC ("CREATE TABLE IF NOT EXISTS reserves_out"
- "(h_blind_ev BYTEA PRIMARY KEY"
+ "(reserve_out_serial_id BIGSERIAL PRIMARY KEY"
+ ",h_blind_ev BYTEA PRIMARY KEY"
",denom_pub BYTEA NOT NULL REFERENCES denominations (denom_pub) ON DELETE CASCADE"
",denom_sig BYTEA NOT NULL"
",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
@@ -360,7 +362,8 @@ postgres_create_tables (void *cls)
* NOTE: maybe we should instead forbid values >= 2^15 categorically?
*/
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_sessions "
- "(session_hash BYTEA PRIMARY KEY CHECK (LENGTH(session_hash)=64)"
+ "(melt_serial_id BIGSERIAL PRIMARY KEY"
+ ",session_hash BYTEA PRIMARY KEY CHECK (LENGTH(session_hash)=64)"
",old_coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
",old_coin_sig BYTEA NOT NULL CHECK(LENGTH(old_coin_sig)=64)"
",amount_with_fee_val INT8 NOT NULL"
@@ -446,7 +449,8 @@ postgres_create_tables (void *cls)
/* Table with information about coins that have been refunded. (Technically
one of the deposit operations that a coin was involved with is refunded.)*/
SQLEXEC("CREATE TABLE IF NOT EXISTS refunds "
- "(coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
+ "(refund_serial_id BIGSERIAL PRIMARY KEY"
+ ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
",merchant_pub BYTEA NOT NULL CHECK(LENGTH(merchant_pub)=32)"
",merchant_sig BYTEA NOT NULL CHECK(LENGTH(merchant_sig)=64)"
",h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)"