29 lines
1.0 KiB
SQL
29 lines
1.0 KiB
SQL
-- Phase 06 #23 — durable per-plugin-invocation audit table.
|
|
--
|
|
-- Capability-use rows already carry `pluginInvocationId`; this table
|
|
-- persists the corresponding high-level invocation outcome without raw
|
|
-- plugin input/output payloads.
|
|
|
|
CREATE TABLE "PluginInvocation" (
|
|
"id" TEXT NOT NULL,
|
|
"tenantId" TEXT NOT NULL,
|
|
"pluginId" TEXT NOT NULL,
|
|
"version" TEXT NOT NULL,
|
|
"hookName" TEXT NOT NULL,
|
|
"outcome" TEXT NOT NULL,
|
|
"failureReason" TEXT,
|
|
"message" TEXT,
|
|
"durationMs" INTEGER NOT NULL,
|
|
"fuelUsed" INTEGER,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "PluginInvocation_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
CREATE INDEX "PluginInvocation_tenantId_createdAt_idx"
|
|
ON "PluginInvocation" ("tenantId", "createdAt" DESC);
|
|
CREATE INDEX "PluginInvocation_tenantId_pluginId_createdAt_idx"
|
|
ON "PluginInvocation" ("tenantId", "pluginId", "createdAt" DESC);
|
|
CREATE INDEX "PluginInvocation_outcome_createdAt_idx"
|
|
ON "PluginInvocation" ("outcome", "createdAt" DESC);
|