-- Drop medium bindings before narrowing the role constraint again. DELETE FROM photo_objects WHERE role = 'medium'; ALTER TABLE photo_objects DROP CONSTRAINT IF EXISTS photo_objects_role_check; ALTER TABLE photo_objects ADD CONSTRAINT photo_objects_role_check CHECK (role IN ('original', 'thumb', 'preview'));