n8n/docs/generated/sqlite-schema/agent_chat_subscriptions.md
Jaakko Husso 92286bdd6a
feat(core): Add instance-scoped agents to the Agents schema (no-changelog)
Add the agents.scope column ('project' or 'instance') and make
agents.projectId nullable. An instance agent is code-defined and belongs
to no project. AgentRepository.ensureInstanceAgent seeds its row.

Type Agent.projectId as string | null. Project-scoped repository queries
filter on scope = 'project' and return ProjectAgent, which has a
non-null projectId. The project-agent APIs refuse an instance agent with
a ForbiddenError (getAgentOrThrow, validateAgentWriteLock, delete).

The SQLite down migration applies the ON DELETE actions by hand, because
foreign keys are off while the table is recreated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 02:48:25 +03:00

2.9 KiB
Generated

agent_chat_subscriptions

Description

Table Definition
CREATE TABLE "agent_chat_subscriptions" ("agentId" varchar(36) NOT NULL, "integrationType" varchar(64) NOT NULL, "credentialId" varchar(255) NOT NULL, "threadId" varchar(255) NOT NULL, "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_chat_subscriptions_integrationType" CHECK ("integrationType" IN ('telegram', 'slack', 'linear', 'discord', 'teams', 'whatsapp')), CONSTRAINT "FK_e79153bd179c011e779d5016796" FOREIGN KEY ("agentId") REFERENCES "agents" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("agentId", "integrationType", "credentialId", "threadId"))

Columns

Name Type Default Nullable Children Parents Comment
agentId varchar(36) false agents
createdAt datetime(3) STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') false
credentialId varchar(255) false
integrationType varchar(64) false
threadId varchar(255) false
updatedAt datetime(3) STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') false

Constraints

Name Type Definition
- CHECK CHECK ("integrationType" IN ('telegram', 'slack', 'linear', 'discord', 'teams', 'whatsapp'))
- (Foreign key ID: 0) FOREIGN KEY FOREIGN KEY (agentId) REFERENCES agents (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE
agentId PRIMARY KEY PRIMARY KEY (agentId)
credentialId PRIMARY KEY PRIMARY KEY (credentialId)
integrationType PRIMARY KEY PRIMARY KEY (integrationType)
sqlite_autoindex_agent_chat_subscriptions_1 PRIMARY KEY PRIMARY KEY (agentId, integrationType, credentialId, threadId)
threadId PRIMARY KEY PRIMARY KEY (threadId)

Indexes

Name Definition
sqlite_autoindex_agent_chat_subscriptions_1 PRIMARY KEY (agentId, integrationType, credentialId, threadId)

Relations

erDiagram

"agent_chat_subscriptions" |o--|| "agents" : "FOREIGN KEY (agentId) REFERENCES agents (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"

"agent_chat_subscriptions" {
  varchar_36_ agentId PK
  datetime_3_ createdAt
  varchar_255_ credentialId PK
  varchar_64_ integrationType PK
  varchar_255_ threadId PK
  datetime_3_ updatedAt
}
"agents" {
  varchar_36_ activeVersionId FK
  boolean availableInMCP
  datetime_3_ createdAt
  varchar_36_ id PK
  TEXT integrations
  varchar_128_ name
  varchar_255_ projectId FK
  INTEGER revision
  TEXT schema
  varchar_16_ scope
  datetime_3_ setupCompletedAt
  TEXT skills
  TEXT tools
  datetime_3_ updatedAt
  varchar_36_ versionId
}

Generated by tbls