CREATE TABLE "agent_channel_status" (
"agentId" varchar(36) NOT NULL,
"integrationType" varchar(64) NOT NULL,
"credentialId" varchar(36) NOT NULL,
"hostId" varchar(128) NOT NULL,
"status" varchar(16) NOT NULL,
"errorMessage" text,
"attempts" integer NOT NULL DEFAULT (0),
"backoffUntil" datetime(3),
"expiresAt" datetime(3),
"createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')),
"updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')),
CONSTRAINT "CHK_agent_channel_status_status" CHECK ("status" IN ('connected', 'error')),
CONSTRAINT "FK_7a723e6aad04d88057dea6a21f4" FOREIGN KEY ("agentId") REFERENCES "agents" ("id") ON DELETE CASCADE,
PRIMARY KEY ("agentId", "integrationType", "credentialId", "hostId")
)