a2a-source-edit: write db/migrations/001_app_records.sql
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
CREATE TABLE IF NOT EXISTS app_records (
|
||||
CREATE TABLE IF NOT EXISTS execution_receipts (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
tenant_key TEXT NOT NULL,
|
||||
record_kind TEXT NOT NULL,
|
||||
payload JSONB NOT NULL,
|
||||
receipt_id TEXT NOT NULL,
|
||||
skill_name TEXT NOT NULL,
|
||||
input_json JSONB NOT NULL,
|
||||
result_json JSONB NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (tenant_key, receipt_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS app_records_tenant_kind_idx
|
||||
ON app_records (tenant_key, record_kind, created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS execution_receipts_tenant_created_idx
|
||||
ON execution_receipts (tenant_key, created_at DESC);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS execution_receipts_skill_idx
|
||||
ON execution_receipts (skill_name, created_at DESC);
|
||||
|
||||
Reference in New Issue
Block a user