a2a-source-edit: write db/migrations/001_app_records.sql
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
CREATE TABLE IF NOT EXISTS app_records (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
CREATE TABLE IF NOT EXISTS execution_receipts (
|
||||
receipt_id TEXT PRIMARY KEY,
|
||||
tenant_key TEXT NOT NULL,
|
||||
record_kind TEXT NOT NULL,
|
||||
payload JSONB NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
skill_name TEXT NOT NULL,
|
||||
input_hash TEXT NOT NULL,
|
||||
result_summary JSONB NOT NULL,
|
||||
persisted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
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_skill_idx
|
||||
ON execution_receipts (tenant_key, skill_name, persisted_at DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS inbound_email_events (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
tenant_key TEXT NOT NULL,
|
||||
sender TEXT NOT NULL,
|
||||
subject TEXT NOT NULL,
|
||||
message_hash TEXT NOT NULL,
|
||||
received_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS inbound_email_events_tenant_received_idx
|
||||
ON inbound_email_events (tenant_key, received_at DESC);
|
||||
|
||||
Reference in New Issue
Block a user