Add deposits read table (CQRS projection from bank_to_exchange events)
Project each bank_to_exchange event into a denormalized deposits table with pre-computed EUR, DKK, and USD amounts using Frankfurter currency rates. Replaces the aggregate get-deposit-totals query. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE deposits (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
event_id BIGINT NOT NULL REFERENCES events(id) UNIQUE,
|
||||
occurred_at TIMESTAMPTZ NOT NULL,
|
||||
exchange TEXT NOT NULL,
|
||||
fiat_amount NUMERIC(18,2) NOT NULL,
|
||||
fiat_currency TEXT NOT NULL,
|
||||
amount_eur NUMERIC(18,2),
|
||||
amount_dkk NUMERIC(18,2),
|
||||
amount_usd NUMERIC(18,2),
|
||||
note TEXT
|
||||
);
|
||||
Reference in New Issue
Block a user