# public.agent_chat_subscriptions

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| agentId | varchar(36) |  | false |  | [public.agents](public.agents.md) | Agent that owns this subscription |
| integrationType | varchar(64) |  | false |  |  | Chat integration platform for this subscription |
| credentialId | varchar(255) |  | false |  |  | Credential connection that owns this subscription |
| threadId | varchar(255) |  | false |  |  | Platform thread ID the agent is subscribed to |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |
| updatedAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| CHK_agent_chat_subscriptions_integrationType | CHECK | CHECK ((("integrationType")::text = ANY ((ARRAY['telegram'::character varying, 'slack'::character varying, 'linear'::character varying])::text[]))) |
| agent_chat_subscriptions_agentId_not_null | n | NOT NULL "agentId" |
| agent_chat_subscriptions_createdAt_not_null | n | NOT NULL "createdAt" |
| agent_chat_subscriptions_credentialId_not_null | n | NOT NULL "credentialId" |
| agent_chat_subscriptions_integrationType_not_null | n | NOT NULL "integrationType" |
| agent_chat_subscriptions_threadId_not_null | n | NOT NULL "threadId" |
| agent_chat_subscriptions_updatedAt_not_null | n | NOT NULL "updatedAt" |
| FK_e79153bd179c011e779d5016796 | FOREIGN KEY | FOREIGN KEY ("agentId") REFERENCES agents(id) ON DELETE CASCADE |
| PK_76598cf91038bee1f3ac94c94bc | PRIMARY KEY | PRIMARY KEY ("agentId", "integrationType", "credentialId", "threadId") |

## Indexes

| Name | Definition |
| ---- | ---------- |
| PK_76598cf91038bee1f3ac94c94bc | CREATE UNIQUE INDEX "PK_76598cf91038bee1f3ac94c94bc" ON public.agent_chat_subscriptions USING btree ("agentId", "integrationType", "credentialId", "threadId") |

## Relations

```mermaid
erDiagram

"public.agent_chat_subscriptions" }o--|| "public.agents" : "FOREIGN KEY (#quot;agentId#quot;) REFERENCES agents(id) ON DELETE CASCADE"

"public.agent_chat_subscriptions" {
  varchar_36_ agentId FK
  varchar_64_ integrationType
  varchar_255_ credentialId
  varchar_255_ threadId
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone updatedAt
}
"public.agents" {
  varchar_36_ id
  varchar_128_ name
  varchar_512_ description
  varchar_255_ projectId FK
  json integrations
  json schema
  json tools
  json skills
  varchar_36_ versionId
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone updatedAt
  varchar_36_ activeVersionId FK
}
```

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
