Files
go-sip/internal/store/migrations/007_mq_command_receipts.sql

11 lines
422 B
SQL

CREATE UNIQUE INDEX IF NOT EXISTS inbox_tenant_command_idx ON inbox(tenant_id, command_id);
CREATE TABLE IF NOT EXISTS mq_command_receipts (
tenant_id TEXT NOT NULL,
command_id TEXT NOT NULL,
response_id TEXT NOT NULL UNIQUE,
PRIMARY KEY (tenant_id, command_id),
FOREIGN KEY (tenant_id, command_id) REFERENCES inbox(tenant_id, command_id),
FOREIGN KEY (response_id) REFERENCES outbox(event_id)
);