UPDATE osint.exhibits AS exhibit
SET width = 220,
    height = 220,
    updated_at = NOW()
FROM osint.document_exhibits AS document
WHERE document.exhibit_id = exhibit.id
  AND document.capture_kind_id = 'clipping'
  AND (exhibit.width <> 220 OR exhibit.height <> 220);

UPDATE osint.document_exhibits AS document
SET title = document.citation_text
WHERE document.capture_kind_id = 'clipping'
  AND BTRIM(document.citation_text) <> ''
  AND (
    BTRIM(document.title) = ''
    OR EXISTS (
      SELECT 1
      FROM osint.assets AS asset
      WHERE asset.id = document.asset_id
        AND document.title = asset.original_name
    )
  );
