Files
finance-app/prisma/migrations/0007_cashflow/migration.sql
T

8 lines
388 B
SQL

-- Add FX conversion support
ALTER TABLE statements ADD COLUMN IF NOT EXISTS exchange_rate_to_aud NUMERIC(10,6);
ALTER TABLE transactions ADD COLUMN IF NOT EXISTS amount_aud NUMERIC(12,2);
-- Backfill: all existing data is AUD
UPDATE transactions SET amount_aud = amount WHERE amount_aud IS NULL;
UPDATE statements SET exchange_rate_to_aud = 1.000000 WHERE exchange_rate_to_aud IS NULL;