UPDATE file_storage_channels
SET
  config = jsonb_set(
    config,
    '{scenes}',
    CASE
      WHEN jsonb_typeof(config->'scenes') = 'array'
        THEN (config->'scenes') || '["request_asset"]'::jsonb
      ELSE '["upload", "image_result", "request_asset"]'::jsonb
    END,
    true
  ),
  updated_at = now()
WHERE deleted_at IS NULL
  AND provider = 'server_main_openapi'
  AND (
    jsonb_typeof(config->'scenes') IS DISTINCT FROM 'array'
    OR NOT (COALESCE(config->'scenes', '[]'::jsonb) ? 'request_asset')
  );
