# 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 |
| taskId | varchar(32) |  | false |  |  | Published task ID whose scheduled run is locked |
| holderId | uuid |  | false |  |  | Ephemeral lock owner token generated by the running main |
| heldUntil | timestamp(3) with time zone |  | false |  |  | Time after which another main can claim this task run lock |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |
| updatedAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| 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" |
| FK_b57a2862ae869aab24e54cefd48 | FOREIGN KEY | FOREIGN KEY ("agentId") REFERENCES agents(id) ON DELETE CASCADE |
| PK_f593adaf7230e964d3c25deda64 | PRIMARY KEY | PRIMARY KEY ("agentId", "taskId") |

## 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
  varchar_32_ taskId
  uuid holderId
  timestamp_3__with_time_zone heldUntil
  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)
