mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-22 12:31:57 +02:00
Two tables behind running a catalog workflow on your own schedule. They are split because the keys differ: consent is one grant per (workflow, person), while one person may want several schedules for the same workflow. The subscription hangs off the grant by composite foreign key, so withdrawing consent takes the schedules with it. The scheduler side needed widening to hold them. A job was identified by `(workflowId, nodeId)`, which is what provisioning diffs and deprovisioning deletes by, and a per-person schedule has no node — several people hold their own schedules for the same workflow. `scheduled_job` gains a nullable, opaque `ownerId` that the scheduler only ever pairs with `taskType` and never interprets, so a feature can own jobs without the scheduler learning about the feature. An owner-scoped job deliberately records no `workflowId`: that column is a foreign key onto `workflow_published_version`, so it means "belongs to a published trigger", which these do not. The type makes passing one impossible. It also means nothing in the database removes these jobs when their owner goes, so callers must deprovision explicitly. The column is added with a raw `ALTER TABLE`: on SQLite the schema builder rebuilds the table, and `scheduled_task` cascades from it, so the rebuild would delete every queued occurrence on the instance. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
15 KiB
15 KiB
public.user
Columns
Constraints
| Name | Type | Definition |
|---|---|---|
| FK_eaea92ee7bfb9c1b6cd01505d56 | FOREIGN KEY | FOREIGN KEY ("roleSlug") REFERENCES role(slug) |
| PK_ea8f538c94b6e352418254ed6474a81f | PRIMARY KEY | PRIMARY KEY (id) |
| UQ_e12875dfb3b1d92d7d7c5377e2 | UNIQUE | UNIQUE (email) |
| user_createdAt_not_null | n | NOT NULL "createdAt" |
| user_disabled_not_null | n | NOT NULL disabled |
| user_id_not_null | n | NOT NULL id |
| user_mfaEnabled_not_null | n | NOT NULL "mfaEnabled" |
| user_roleSlug_not_null | n | NOT NULL "roleSlug" |
| user_updatedAt_not_null | n | NOT NULL "updatedAt" |
Indexes
| Name | Definition |
|---|---|
| PK_ea8f538c94b6e352418254ed6474a81f | CREATE UNIQUE INDEX "PK_ea8f538c94b6e352418254ed6474a81f" ON public."user" USING btree (id) |
| UQ_e12875dfb3b1d92d7d7c5377e2 | CREATE UNIQUE INDEX "UQ_e12875dfb3b1d92d7d7c5377e2" ON public."user" USING btree (email) |
| user_role_idx | CREATE INDEX user_role_idx ON public."user" USING btree ("roleSlug") |
Relations
erDiagram
"public.agent_eval_dataset" }o--o| "public.user" : "FOREIGN KEY (#quot;createdById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.agent_eval_rating" }o--o| "public.user" : "FOREIGN KEY (#quot;ratedById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.agent_eval_run" }o--o| "public.user" : "FOREIGN KEY (#quot;createdById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.agent_history" }o--o| "public.user" : "FOREIGN KEY (#quot;publishedById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.auth_identity" }o--o| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id)"
"public.chat_hub_agents" }o--|| "public.user" : "FOREIGN KEY (#quot;ownerId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.chat_hub_sessions" }o--|| "public.user" : "FOREIGN KEY (#quot;ownerId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.chat_hub_tools" }o--|| "public.user" : "FOREIGN KEY (#quot;ownerId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.dynamic_credential_user_entry" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.evaluation_collection" }o--o| "public.user" : "FOREIGN KEY (#quot;createdById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.instance_ai_mcp_registry_connections" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.instance_ai_pending_confirmations" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.instance_ai_thread_grants" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.oauth_access_tokens" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.oauth_authorization_codes" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.oauth_refresh_tokens" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.oauth_user_consents" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.project" }o--o| "public.user" : "FOREIGN KEY (#quot;creatorId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.project_relation" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.user_api_keys" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.user_favorites" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.workflow_builder_session" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.workflow_credential_binding" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.workflow_publish_history" }o--o| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.workflow_review_request" }o--o| "public.user" : "FOREIGN KEY (#quot;createdById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.workflow_review_request" }o--o| "public.user" : "FOREIGN KEY (#quot;updatedById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.workflow_review_request" }o--o| "public.user" : "FOREIGN KEY (#quot;closedById#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.workflow_review_request_authors" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.workflow_review_request_reviewers" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"
"public.user" }o--|| "public.role" : "FOREIGN KEY (#quot;roleSlug#quot;) REFERENCES role(slug)"
"public.user" {
timestamp_3__with_time_zone createdAt
boolean disabled
varchar_255_ email
varchar_32_ firstName
uuid id
date lastActiveAt
varchar_32_ lastName
boolean mfaEnabled
text mfaRecoveryCodes
text mfaSecret
varchar_255_ password
json personalizationAnswers
varchar_128_ roleSlug FK
json settings
timestamp_3__with_time_zone updatedAt
}
"public.agent_eval_dataset" {
varchar_36_ agentId FK
json columnMapping
timestamp_3__with_time_zone createdAt
uuid createdById FK
json datasetRef
varchar_32_ datasetSource
text description
varchar_36_ id
varchar_128_ name
timestamp_3__with_time_zone updatedAt
}
"public.agent_eval_rating" {
text comment
json correction
timestamp_3__with_time_zone createdAt
varchar_36_ id
uuid ratedById FK
varchar_36_ resultId FK
timestamp_3__with_time_zone updatedAt
varchar_8_ vote
}
"public.agent_eval_run" {
varchar_36_ agentVersionId
boolean cancelRequested
timestamp_3__with_time_zone completedAt
timestamp_3__with_time_zone createdAt
uuid createdById FK
varchar_36_ datasetId FK
varchar_255_ errorCode
json errorDetails
varchar_36_ id
json metrics
timestamp_3__with_time_zone runAt
varchar_255_ runningInstanceId
varchar status
timestamp_3__with_time_zone updatedAt
}
"public.agent_history" {
varchar_36_ agentId FK
varchar_255_ author
timestamp_3__with_time_zone createdAt
uuid publishedById FK
json schema
json skills
json tools
timestamp_3__with_time_zone updatedAt
varchar_36_ versionId
}
"public.auth_identity" {
timestamp_3__with_time_zone createdAt
varchar_255_ providerId
varchar_32_ providerType
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.chat_hub_agents" {
timestamp_3__with_time_zone createdAt
varchar_36_ credentialId FK
varchar_512_ description
json files
json icon
uuid id
varchar_64_ model
varchar_256_ name
uuid ownerId FK
varchar_16_ provider
json suggestedPrompts
text systemPrompt
timestamp_3__with_time_zone updatedAt
}
"public.chat_hub_sessions" {
uuid agentId FK
varchar_128_ agentName
timestamp_3__with_time_zone createdAt
varchar_36_ credentialId FK
uuid id
timestamp_3__with_time_zone lastMessageAt
varchar_256_ model
uuid ownerId FK
varchar_16_ provider
varchar_256_ title
varchar_16_ type
timestamp_3__with_time_zone updatedAt
varchar_36_ workflowId FK
}
"public.chat_hub_tools" {
timestamp_3__with_time_zone createdAt
json definition
boolean enabled
uuid id
varchar_255_ name
uuid ownerId FK
varchar_255_ type
double_precision typeVersion
timestamp_3__with_time_zone updatedAt
}
"public.dynamic_credential_user_entry" {
timestamp_3__with_time_zone createdAt
varchar_16_ credentialId FK
text data
varchar_16_ resolverId FK
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.evaluation_collection" {
timestamp_3__with_time_zone createdAt
uuid createdById FK
text description
varchar_36_ evaluationConfigId FK
varchar_36_ id
json insightsCache
varchar_128_ name
timestamp_3__with_time_zone updatedAt
varchar_36_ workflowId FK
}
"public.instance_ai_mcp_registry_connections" {
timestamp_3__with_time_zone createdAt
varchar_36_ credentialId FK
uuid id
varchar_255_ serverSlug FK
json toolFilter
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.instance_ai_pending_confirmations" {
varchar_255_ checkpointKey FK
varchar_36_ checkpointTaskId
timestamp_3__with_time_zone createdAt
timestamp_3__with_time_zone expiresAt
varchar_16_ kind
varchar_36_ messageGroupId
varchar_36_ requestId
varchar_36_ runId
uuid threadId FK
varchar_64_ toolCallId
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.instance_ai_thread_grants" {
timestamp_3__with_time_zone createdAt
varchar_512_ grantKey
uuid threadId FK
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.oauth_access_tokens" {
varchar clientId FK
varchar token
uuid userId FK
}
"public.oauth_authorization_codes" {
varchar clientId FK
varchar_255_ code
varchar codeChallenge
varchar_255_ codeChallengeMethod
timestamp_3__with_time_zone createdAt
bigint expiresAt
varchar redirectUri
varchar resource
json scope
varchar state
timestamp_3__with_time_zone updatedAt
boolean used
uuid userId FK
}
"public.oauth_refresh_tokens" {
varchar clientId FK
timestamp_3__with_time_zone createdAt
bigint expiresAt
json scope
varchar_255_ token
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.oauth_user_consents" {
varchar clientId FK
bigint grantedAt
integer id
json scope
uuid userId FK
}
"public.project" {
timestamp_3__with_time_zone createdAt
uuid creatorId FK
json customTelemetryTags
varchar_512_ description
json icon
varchar_36_ id
varchar_255_ name
varchar_36_ type
timestamp_3__with_time_zone updatedAt
}
"public.project_relation" {
timestamp_3__with_time_zone createdAt
varchar_36_ projectId FK
varchar role FK
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.user_api_keys" {
varchar apiKey
varchar audience
timestamp_3__with_time_zone createdAt
varchar_36_ id
varchar_100_ label
timestamp_3__with_time_zone lastUsedAt
json scopes
timestamp_3__with_time_zone updatedAt
uuid userId FK
}
"public.user_favorites" {
integer id
varchar_255_ resourceId
varchar_64_ resourceType
uuid userId FK
}
"public.workflow_builder_session" {
varchar_255_ activeVersionCardId
timestamp_3__with_time_zone createdAt
uuid id
json messages
text previousSummary
varchar_255_ resumeAfterRestoreMessageId
timestamp_3__with_time_zone updatedAt
uuid userId FK
varchar_36_ workflowId FK
}
"public.workflow_credential_binding" {
timestamp_3__with_time_zone consentAt
timestamp_3__with_time_zone createdAt
varchar_16_ status
timestamp_3__with_time_zone updatedAt
uuid userId FK
varchar_36_ workflowId FK
}
"public.workflow_publish_history" {
timestamp_3__with_time_zone createdAt
varchar_36_ event
integer id
uuid userId FK
varchar_36_ versionId FK
varchar_36_ workflowId FK
}
"public.workflow_review_request" {
timestamp_3__with_time_zone approvedAt
uuid closedById FK
timestamp_3__with_time_zone createdAt
uuid createdById FK
varchar_50_ decision
text description
varchar_36_ id
varchar_36_ projectId FK
varchar_16_ state
varchar_255_ title
timestamp_3__with_time_zone updatedAt
uuid updatedById FK
}
"public.workflow_review_request_authors" {
uuid userId FK
varchar_36_ workflowReviewRequestId FK
}
"public.workflow_review_request_reviewers" {
uuid userId FK
varchar_36_ workflowReviewRequestId FK
}
"public.role" {
timestamp_3__with_time_zone createdAt
text description
text displayName
text roleType
varchar_128_ slug
boolean systemRole
timestamp_3__with_time_zone updatedAt
}
Generated by tbls