Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files. Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
11 lines
453 B
SQL
11 lines
453 B
SQL
CREATE TABLE idempotency_keys (
|
|
chat_id uuid NOT NULL,
|
|
user_id uuid NOT NULL,
|
|
key text NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'),
|
|
fingerprint bytea NOT NULL CHECK (octet_length(fingerprint) = 32),
|
|
message_id uuid NOT NULL REFERENCES messages (id) ON DELETE CASCADE,
|
|
created_at timestamptz NOT NULL,
|
|
PRIMARY KEY (chat_id, user_id, key),
|
|
FOREIGN KEY (chat_id, user_id) REFERENCES chat_members (chat_id, user_id)
|
|
);
|