-- Migration: Add tactical columns and FPS metadata
-- Run this in your Supabase SQL Editor

-- 1. Add tactical_x and tactical_y to detections table
ALTER TABLE detections 
ADD COLUMN IF NOT EXISTS tactical_x REAL,
ADD COLUMN IF NOT EXISTS tactical_y REAL;

-- 2. Add fps to analysis_results table
ALTER TABLE analysis_results
ADD COLUMN IF NOT EXISTS fps REAL DEFAULT 30.0;

-- 3. (Optional) Backfill existing data from JSONB if desired
-- UPDATE detections 
-- SET tactical_x = (keypoints->>'tactical_x')::real,
--     tactical_y = (keypoints->>'tactical_y')::real
-- WHERE keypoints ? 'tactical_x';
