UPDATE model_pricing_rules
SET formula_config = jsonb_set(
      COALESCE(formula_config, '{}'::jsonb),
      '{formula}',
      to_jsonb(replace(
        formula_config->>'formula',
        'ceil(duration_seconds / 5)',
        '(duration_seconds / 5)'
      )),
      true
    ),
    updated_at = now()
WHERE resource_type = 'video'
  AND strpos(formula_config->>'formula', 'ceil(duration_seconds / 5)') > 0;
