-- Migration 035: Add is_anomalous column to price_observations
-- This column marks price entries as outliers/anomalous that should be excluded from display

ALTER TABLE price_observations
  ADD COLUMN IF NOT EXISTS is_anomalous BOOLEAN NOT NULL DEFAULT false;

CREATE INDEX IF NOT EXISTS idx_price_obs_anomalous
  ON price_observations (transceiver_id, is_anomalous)
  WHERE is_anomalous = false;

COMMENT ON COLUMN price_observations.is_anomalous IS
  'True when this price is flagged as an outlier/anomaly and should be excluded from price displays and comparisons';
