Files
mtusi2026lab4/internal/store/migrations/0005_message_empty_text.sql
T

11 lines
492 B
SQL

-- Lab4 contract: a message may carry text = "" when it references at least one
-- attachment of the chat (contracts/README.md, "Вложения"). The HTTP handler
-- still rejects empty or blank text without attachments; the database
-- constraint only widens to permit the documented attachment-only message.
ALTER TABLE messages
DROP CONSTRAINT messages_text_length;
ALTER TABLE messages
ADD CONSTRAINT messages_text_length
CHECK (char_length(text) BETWEEN 0 AND 4000);