# public.workflow_publish_history

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | integer |  | false |  |  |  |
| workflowId | varchar(36) |  | false |  | [public.workflow_entity](public.workflow_entity.md) |  |
| versionId | varchar(36) |  | true |  | [public.workflow_history](public.workflow_history.md) |  |
| event | varchar(36) |  | false |  |  | Type of history record: activated (workflow is now active), deactivated (workflow is now inactive) |
| userId | uuid |  | true |  | [public.user](public.user.md) |  |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| CHK_workflow_publish_history_event | CHECK | CHECK (((event)::text = ANY ((ARRAY['activated'::character varying, 'deactivated'::character varying])::text[]))) |
| workflow_publish_history_createdAt_not_null | n | NOT NULL "createdAt" |
| workflow_publish_history_event_not_null | n | NOT NULL event |
| workflow_publish_history_id_not_null | n | NOT NULL id |
| workflow_publish_history_workflowId_not_null | n | NOT NULL "workflowId" |
| FK_6eab5bd9eedabe9c54bd879fc40 | FOREIGN KEY | FOREIGN KEY ("userId") REFERENCES "user"(id) ON DELETE SET NULL |
| FK_c01316f8c2d7101ec4fa9809267 | FOREIGN KEY | FOREIGN KEY ("workflowId") REFERENCES workflow_entity(id) ON DELETE CASCADE |
| FK_b4cfbc7556d07f36ca177f5e473 | FOREIGN KEY | FOREIGN KEY ("versionId") REFERENCES workflow_history("versionId") ON DELETE SET NULL |
| PK_c788f7caf88e91e365c97d6d04a | PRIMARY KEY | PRIMARY KEY (id) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| PK_c788f7caf88e91e365c97d6d04a | CREATE UNIQUE INDEX "PK_c788f7caf88e91e365c97d6d04a" ON public.workflow_publish_history USING btree (id) |
| IDX_070b5de842ece9ccdda0d9738b | CREATE INDEX "IDX_070b5de842ece9ccdda0d9738b" ON public.workflow_publish_history USING btree ("workflowId", "versionId") |

## Relations

```mermaid
erDiagram

"public.workflow_publish_history" }o--|| "public.workflow_entity" : "FOREIGN KEY (#quot;workflowId#quot;) REFERENCES workflow_entity(id) ON DELETE CASCADE"
"public.workflow_publish_history" }o--o| "public.workflow_history" : "FOREIGN KEY (#quot;versionId#quot;) REFERENCES workflow_history(#quot;versionId#quot;) ON DELETE SET NULL"
"public.workflow_publish_history" }o--o| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"

"public.workflow_publish_history" {
  integer id
  varchar_36_ workflowId FK
  varchar_36_ versionId FK
  varchar_36_ event
  uuid userId FK
  timestamp_3__with_time_zone createdAt
}
"public.workflow_entity" {
  varchar_128_ name
  boolean active
  json nodes
  json connections
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone updatedAt
  json settings
  json staticData
  json pinData
  character_36_ versionId
  integer triggerCount
  varchar_36_ id
  json meta
  varchar_36_ parentFolderId FK
  boolean isArchived
  integer versionCounter
  text description
  varchar_36_ activeVersionId FK
  json nodeGroups
  varchar sourceWorkflowId
}
"public.workflow_history" {
  varchar_36_ versionId
  varchar_36_ workflowId FK
  varchar_255_ authors
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone updatedAt
  json nodes
  json connections
  varchar_128_ name
  boolean autosaved
  text description
  json nodeGroups
}
"public.user" {
  uuid id
  varchar_255_ email
  varchar_32_ firstName
  varchar_32_ lastName
  varchar_255_ password
  json personalizationAnswers
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone updatedAt
  json settings
  boolean disabled
  boolean mfaEnabled
  text mfaSecret
  text mfaRecoveryCodes
  date lastActiveAt
  varchar_128_ roleSlug FK
}
```

---

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