18 lines
647 B
SQL
18 lines
647 B
SQL
-- +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;
|