feat: Implement currency management with models, routes, and UI updates; add backfill script for existing records
This commit is contained in:
29
scripts/migrations/20251021_add_currency_and_unit_fields.sql
Normal file
29
scripts/migrations/20251021_add_currency_and_unit_fields.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- 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;
|
||||
Reference in New Issue
Block a user