ALTER TABLE redemption_codes ADD COLUMN IF NOT EXISTS code_encrypted TEXT; CREATE INDEX IF NOT EXISTS idx_redemption_codes_benefit_created ON redemption_codes(benefit_kind, created_at DESC); CREATE INDEX IF NOT EXISTS idx_redemption_codes_plan_created ON redemption_codes(plan_id, created_at DESC) WHERE plan_id IS NOT NULL;