-- migrations/XXXXXX_add_balances_table.sql

CREATE TABLE IF NOT EXISTS balances (
    id SERIAL PRIMARY KEY,
    account_id VARCHAR(50) NOT NULL,
    balance_type VARCHAR(50) NOT NULL,
    amount TEXT NOT NULL,
    currency VARCHAR(3) NOT NULL,
    date_time TIMESTAMPTZ NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    
    UNIQUE(account_id, balance_type)
);

CREATE INDEX IF NOT EXISTS idx_balances_account_id ON balances(account_id);
