-- ================================================================================================ -- Migration 043 DOWN: Rollback Outcome Tracking Fields -- Removes actual_outcome, closed_at, entry_price fields and related functions -- ================================================================================================ -- Revoke permissions REVOKE EXECUTE ON FUNCTION get_real_performance_metrics FROM foxhunt; REVOKE EXECUTE ON FUNCTION update_model_performance_metrics FROM foxhunt; -- Drop trigger and function DROP TRIGGER IF EXISTS trg_update_model_performance ON ensemble_predictions; DROP FUNCTION IF EXISTS get_real_performance_metrics(VARCHAR, INTEGER); DROP FUNCTION IF EXISTS update_model_performance_metrics(); -- Drop indexes (in reverse order) DROP INDEX IF EXISTS idx_ensemble_predictions_pnl_outcome; DROP INDEX IF EXISTS idx_ensemble_predictions_open_positions; DROP INDEX IF EXISTS idx_ensemble_predictions_outcome; -- Remove constraint ALTER TABLE ensemble_predictions DROP CONSTRAINT IF EXISTS chk_actual_outcome; -- Remove columns ALTER TABLE ensemble_predictions DROP COLUMN IF EXISTS entry_price, DROP COLUMN IF EXISTS closed_at, DROP COLUMN IF EXISTS actual_outcome; -- ================================================================================================ -- END MIGRATION 043 DOWN -- ================================================================================================