# public.agent_task_run_lock

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| agentId | varchar(36) |  | false |  | [public.agents](public.agents.md) | Published agent whose scheduled task run is locked |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |
| heldUntil | timestamp(3) with time zone |  | false |  |  | Time after which another main can claim this task run lock |
| holderId | uuid |  | false |  |  | Ephemeral lock owner token generated by the running main |
| taskId | varchar(32) |  | false |  |  | Published task ID whose scheduled run is locked |
| updatedAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| FK_b57a2862ae869aab24e54cefd48 | FOREIGN KEY | FOREIGN KEY ("agentId") REFERENCES agents(id) ON DELETE CASCADE |
| PK_f593adaf7230e964d3c25deda64 | PRIMARY KEY | PRIMARY KEY ("agentId", "taskId") |
| agent_task_run_lock_agentId_not_null | n | NOT NULL "agentId" |
| agent_task_run_lock_createdAt_not_null | n | NOT NULL "createdAt" |
| agent_task_run_lock_heldUntil_not_null | n | NOT NULL "heldUntil" |
| agent_task_run_lock_holderId_not_null | n | NOT NULL "holderId" |
| agent_task_run_lock_taskId_not_null | n | NOT NULL "taskId" |
| agent_task_run_lock_updatedAt_not_null | n | NOT NULL "updatedAt" |

## Indexes

| Name | Definition |
| ---- | ---------- |
| PK_f593adaf7230e964d3c25deda64 | CREATE UNIQUE INDEX "PK_f593adaf7230e964d3c25deda64" ON public.agent_task_run_lock USING btree ("agentId", "taskId") |

## Relations

```mermaid
erDiagram

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

"public.agent_task_run_lock" {
  varchar_36_ agentId FK
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone heldUntil
  uuid holderId
  varchar_32_ taskId
  timestamp_3__with_time_zone updatedAt
}
"public.agents" {
  varchar_36_ activeVersionId FK
  boolean availableInMCP
  timestamp_3__with_time_zone createdAt
  varchar_36_ id
  json integrations
  varchar_128_ name
  varchar_255_ projectId FK
  integer revision
  json schema
  timestamp_3__with_time_zone setupCompletedAt
  json skills
  json tools
  timestamp_3__with_time_zone updatedAt
  varchar_36_ versionId
}
```

---

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