-- Rows of the new kind must go before the old constraint can be restored. DELETE FROM message_attachments WHERE kind = 'quote'; ALTER TABLE message_attachments DROP CONSTRAINT IF EXISTS message_attachments_kind_check; ALTER TABLE message_attachments ADD CONSTRAINT message_attachments_kind_check CHECK (kind IN ('image', 'video', 'audio', 'file', 'link', 'entity'));