-- Intel Edit Modal Support
-- Adds user notes and manual edit tracking columns
-- Run this in Supabase SQL Editor

-- ============================================
-- COMPANY INTEL - Add edit support columns
-- ============================================

ALTER TABLE company_intel
ADD COLUMN IF NOT EXISTS user_notes TEXT,
ADD COLUMN IF NOT EXISTS manually_updated BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS updated_by TEXT,
ADD COLUMN IF NOT EXISTS notes_updated_at TIMESTAMPTZ;

-- ============================================
-- LEAD INTEL - Add edit support columns
-- ============================================

ALTER TABLE lead_intel
ADD COLUMN IF NOT EXISTS user_notes TEXT,
ADD COLUMN IF NOT EXISTS manually_updated BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS updated_by TEXT,
ADD COLUMN IF NOT EXISTS notes_updated_at TIMESTAMPTZ;

-- ============================================
-- VERIFY
-- ============================================

SELECT 'company_intel columns:' as info;
SELECT column_name, data_type FROM information_schema.columns
WHERE table_name = 'company_intel' ORDER BY ordinal_position;

SELECT 'lead_intel columns:' as info;
SELECT column_name, data_type FROM information_schema.columns
WHERE table_name = 'lead_intel' ORDER BY ordinal_position;
