fix: preserve NUL characters in persisted messages

Store message text as UTF-8 bytes and migrate existing rows without loss.
Cover HTTP round trips, restart persistence, Unicode limits and idempotent retries.
Adapt direct database tools to the binary storage format.

(cherry picked from commit 386276532730b8758298080b49db63738ca300a4)
This commit is contained in:
Самохвалов Андрей Ремович
2026-11-07 09:53:49 +03:00
parent 255c11a822
commit f2e074d9f2
7 changed files with 168 additions and 6 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ class ReconcileTests(unittest.TestCase):
message_id = uuid4()
conn.execute(
"INSERT INTO messages (id,chat_id,sender_id,text) VALUES (%s,%s,%s,%s)",
(message_id, UUID(chat["id"]), UUID(owner["id"]), ""),
(message_id, UUID(chat["id"]), UUID(owner["id"]), b""),
)
conn.execute(
"INSERT INTO message_attachments (message_id,chat_id,attachment_id,position) VALUES (%s,%s,%s,0)",