ALTER TABLE public.legal_matters
ADD COLUMN IF NOT EXISTS has_payment_plan BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN IF NOT EXISTS is_bankruptcy BOOLEAN NOT NULL DEFAULT false;

CREATE INDEX IF NOT EXISTS idx_legal_matters_has_payment_plan
ON public.legal_matters(has_payment_plan)
WHERE has_payment_plan = true;

CREATE INDEX IF NOT EXISTS idx_legal_matters_is_bankruptcy
ON public.legal_matters(is_bankruptcy)
WHERE is_bankruptcy = true;