feat(db): add idempotency keys table
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE idempotency_keys (
|
||||
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||||
method text NOT NULL,
|
||||
path text NOT NULL,
|
||||
key text NOT NULL,
|
||||
request_hash text NOT NULL,
|
||||
message_id uuid NOT NULL REFERENCES messages (id) ON DELETE CASCADE
|
||||
DEFERRABLE INITIALLY DEFERRED,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (user_id, method, path, key)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_idempotency_keys_created_at ON idempotency_keys (created_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE idempotency_keys;
|
||||
Reference in New Issue
Block a user