a2a-source-edit: write db/migrations/001_app_records.sql

This commit is contained in:
a2a-cloud
2026-07-19 18:58:49 +00:00
parent ce0b40c902
commit dbcca9c413

View File

@@ -1,11 +1,17 @@
CREATE TABLE IF NOT EXISTS app_records ( CREATE TABLE IF NOT EXISTS execution_receipts (
id BIGSERIAL PRIMARY KEY, id BIGSERIAL PRIMARY KEY,
tenant_key TEXT NOT NULL, tenant_key TEXT NOT NULL,
record_kind TEXT NOT NULL, receipt_id TEXT NOT NULL,
payload JSONB NOT NULL, skill_name TEXT NOT NULL,
input_json JSONB NOT NULL,
result_json JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), 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 CREATE INDEX IF NOT EXISTS execution_receipts_tenant_created_idx
ON app_records (tenant_key, record_kind, created_at DESC); 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);