-- Stonks Oracle - Recommendation persistence enhancements
-- Adds full model metadata columns to recommendations table
-- and a risk_classification column for the computed risk label.
-- Requirements: 7.1, 7.2, 8.3

-- Store full model provenance on the recommendation itself
ALTER TABLE recommendations
    ADD COLUMN IF NOT EXISTS model_provider VARCHAR(100) DEFAULT 'deterministic',
    ADD COLUMN IF NOT EXISTS prompt_version VARCHAR(100) DEFAULT '',
    ADD COLUMN IF NOT EXISTS schema_version VARCHAR(50) DEFAULT '1.0.0',
    ADD COLUMN IF NOT EXISTS risk_classification VARCHAR(20) DEFAULT 'moderate';

-- Index for querying recommendations by risk classification
CREATE INDEX IF NOT EXISTS idx_recommendations_risk
    ON recommendations(risk_classification);
