-- CalMiner Migration: add currency and unit metadata columns
-- Date: 2025-10-21
-- Purpose: align persisted schema with API changes introducing currency selection for
--          CAPEX/OPEX costs and unit selection for consumption/production records.

BEGIN;

-- CAPEX / OPEX
ALTER TABLE capex
    ADD COLUMN currency_code VARCHAR(3) NOT NULL DEFAULT 'USD';

ALTER TABLE opex
    ADD COLUMN currency_code VARCHAR(3) NOT NULL DEFAULT 'USD';

-- Consumption tracking
ALTER TABLE consumption
    ADD COLUMN unit_name VARCHAR(64);

ALTER TABLE consumption
    ADD COLUMN unit_symbol VARCHAR(16);

-- Production output
ALTER TABLE production_output
    ADD COLUMN unit_name VARCHAR(64);

ALTER TABLE production_output
    ADD COLUMN unit_symbol VARCHAR(16);

COMMIT;
