-- Create a function that allows executing arbitrary SQL (service role only via edge functions)
CREATE OR REPLACE FUNCTION public.exec_sql(query text)
RETURNS void
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = public
AS $$
BEGIN
  EXECUTE query;
END;
$$;

-- Add indexes_dropped column to import_jobs to track index state
ALTER TABLE public.import_jobs ADD COLUMN IF NOT EXISTS indexes_dropped boolean DEFAULT false;
