Files
mtusi2026lab5/migrations/004_message_text_bytes.sql
T

9 lines
413 B
SQL

-- Lab4: message text may contain U+0000, which PostgreSQL TEXT/JSONB cannot store.
-- Text is kept as exact UTF-8 bytes; the idempotent response snapshot as JSON
-- (textual JSON keeps the "\u0000" escape, JSONB rejects it).
ALTER TABLE messages
ALTER COLUMN text TYPE BYTEA USING convert_to(text, 'UTF8');
ALTER TABLE idempotency_records
ALTER COLUMN response_body TYPE JSON USING response_body::json;