lab 3 done

This commit is contained in:
Khakimov Dmitrij
2026-10-20 20:46:51 +03:00
parent 0ab3a341aa
commit f9015df5d1
113 changed files with 6763 additions and 49 deletions
+10
View File
@@ -0,0 +1,10 @@
-- +goose Up
-- Additive: old lab2 writers can still insert NULL keys during migration.
ALTER TABLE messages ADD COLUMN IF NOT EXISTS idempotency_key text
CHECK (idempotency_key ~ '^[A-Za-z0-9._:-]{1,128}$');
CREATE UNIQUE INDEX IF NOT EXISTS messages_idempotency_idx
ON messages(sender_id, chat_id, idempotency_key);
-- +goose Down
DROP INDEX messages_idempotency_idx;
ALTER TABLE messages DROP COLUMN idempotency_key;