Добавить X-Instance-Id, обязательный Idempotency-Key и мягкую остановку API

This commit is contained in:
Pavel Grigorev
2026-11-12 19:45:14 +03:00
parent 0ab3a341aa
commit 291dfe65bf
20 changed files with 1087 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
CREATE TABLE idempotency_keys (
user_id uuid NOT NULL REFERENCES users (id),
scope text NOT NULL,
key text NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'),
request_hash bytea NOT NULL CHECK (octet_length(request_hash) = 32),
message_id uuid REFERENCES messages (id),
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (user_id, scope, key)
);
CREATE INDEX idempotency_keys_created_idx ON idempotency_keys (created_at);