Add buys query table from exchange_to_wallet events
Denormalized read table with id, event_id, occurred_at, wallet, sats, fee_sats, and amount_eur. Projected on event creation and rebuildable via POST /api/buys/rebuild. Fiat amounts converted to EUR using Frankfurter rates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE buys (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
event_id BIGINT NOT NULL REFERENCES events(id) UNIQUE,
|
||||
occurred_at DATE NOT NULL,
|
||||
wallet TEXT NOT NULL,
|
||||
amount_eur NUMERIC(18,2) NOT NULL
|
||||
);
|
||||
Reference in New Issue
Block a user