-- Migration: Add missing type and payment_method columns to orders table
-- Purpose: Ensure physical columns type and payment_method exist on public.orders for checkout split support.

ALTER TABLE public.orders ADD COLUMN IF NOT EXISTS type TEXT NOT NULL DEFAULT 'purchase' CHECK (type IN ('purchase', 'subscription'));
ALTER TABLE public.orders ADD COLUMN IF NOT EXISTS payment_method TEXT;

NOTIFY pgrst, 'reload schema';
