penpot/backend/src/app/migrations/sql/0062-fix-metadata-media.sql
2021-11-15 09:53:10 -05:00

9 lines
257 B
SQL

-- Fix problem with content-type incoherence
UPDATE storage_object so
SET metadata = jsonb_set(metadata, '{~:content-type}', to_jsonb(fmo.mtype))
FROM file_media_object fmo
WHERE so.id = fmo.media_id and
so.metadata->>'~:content-type' != fmo.mtype;