跳转至

public.scheduled_job

列

名称 类型 默认值 可空 子表 父表 注释
concurrencyLimit integer true 此任务可同时运行的触发实例数量。NULL 表示无限制。
createdAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false
cronExpression varchar(255) true Cron 表达式。当 kind 为 'cron' 时它表示调度计划;当为 'recurring_cron' 时,它列出候选运行时间,由 every-N-periods 过滤器每隔 N 个保留一个。
enabled boolean true false 调度器是否考虑触发此任务。
fireAt timestamp(3) with time zone true 任务一次性触发的绝对时间;仅在 kind 为 'one_off' 时设置。
id integer false public.scheduled_task
intervalSeconds integer true 两次触发之间的间隔(秒);仅在 kind 为 'interval' 时设置。
kind varchar(16) false 重复类型;决定下方哪些调度列适用。
lastDispatchedAt timestamp(3) with time zone true 此任务最新触发实例报告其效果的时间。该字段在触发实例行被保留策略清理后仍然保留。
lastFiredAt timestamp(3) with time zone true 最近一次触发实例被生成的时间;用于重新计算 nextRunAt。
maxAttempts integer 1 false 重试次数上限,会复制到该任务生成的每个触发实例上。
misfireGraceSeconds integer 60 false 触发实例可延迟多久才会对其应用 misfire 策略;普通重启仍处于该范围内。
misfirePolicy varchar(16) 'coalesce'::character varying false 当触发实例已到期却没有任何调度器运行它们时的处理方式:'coalesce' 为每个任务记录一次延迟运行,'coalesce_owner' 为同一所有者调度的所有任务记录一次,'skip' 不记录。
name varchar(255) false 人类可读的任务名称。系统任务使用预定义的调度器键;工作流触发任务则由系统生成。
nextRunAt timestamp(3) with time zone true 下一次触发实例到期的时间;调度器扫描读取该字段以发现待执行工作。一旦禁用或一次性任务已触发,则为 NULL。
orphanedAt timestamp(3) with time zone true 对账扫描最近一次确认此任务的所有者已不存在的时间;所有者存活期间为 NULL。隔离标记:任务的时间信息会先被清除,仅当该时间戳早于隔离宽限期(即已超过宽限期)时,任务才会被删除。
ownerId varchar(255) false 该所有者类型下的具体所有者:工作流 id、系统任务名称或代理 id。删除所有者不会删除此行;所属模块会显式解除配置,而对账扫描是兜底。
ownerMemberId varchar(64) true 所有者内部的可选子标识,例如工作流的触发节点 id;当所有者没有组成部分时为 NULL。
ownerType varchar(32) false 拥有此任务的对象类型,例如 'workflow' 或 'system-task'。它不是枚举:调度器仅对其进行比较,因此新增所有者类型无需修改模式(schema)。
payload json '{}'::json false 触发实例运行时传递给任务处理程序的输入。
recurrenceSize integer true recurring_cron 调度的 every-N-periods 过滤器中的 N,例如每 3 周为 3;至少为 2。仅在 kind 为 'recurring_cron' 时设置。
recurrenceUnit varchar(16) true recurring_cron 调度的 every-N-periods 过滤器所计数的日历周期(hours、days、weeks、months)。仅在 kind 为 'recurring_cron' 时设置。
taskType varchar(128) false 选择运行该任务的已注册处理程序。
timeoutSeconds integer 300 false 在执行器停止之前,某个触发实例的单次尝试可运行的时长(秒)。
timezone varchar(64) true 计算 cron 表达式所使用的 IANA 时区;NULL 使用实例默认时区。
updatedAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false

约束

名称 类型 定义
CHK_scheduled_job_concurrencyLimit CHECK CHECK ((("concurrencyLimit" IS NULL) OR (("concurrencyLimit" >= 1) AND ("concurrencyLimit" <= 2147483647))))
CHK_scheduled_job_cron_expression CHECK CHECK ((((kind)::text <> 'cron'::text) OR ("cronExpression" IS NOT NULL)))
CHK_scheduled_job_fire_at CHECK CHECK ((((kind)::text <> 'one_off'::text) OR ("fireAt" IS NOT NULL)))
CHK_scheduled_job_interval_seconds CHECK CHECK ((((kind)::text <> 'interval'::text) OR ("intervalSeconds" IS NOT NULL)))
CHK_scheduled_job_kind CHECK CHECK (((kind)::text = ANY ((ARRAY['cron'::character varying, 'interval'::character varying, 'one_off'::character varying, 'recurring_cron'::character varying])::text[])))
CHK_scheduled_job_misfireGraceSeconds CHECK CHECK (("misfireGraceSeconds" > 0))
CHK_scheduled_job_misfirePolicy CHECK CHECK ((("misfirePolicy")::text = ANY ((ARRAY['coalesce'::character varying, 'skip'::character varying, 'coalesce_owner'::character varying])::text[])))
CHK_scheduled_job_recurrence_size CHECK CHECK (("recurrenceSize" >= 2))
CHK_scheduled_job_recurrence_unit CHECK CHECK ((("recurrenceUnit")::text = ANY ((ARRAY['hours'::character varying, 'days'::character varying, 'weeks'::character varying, 'months'::character varying])::text[])))
CHK_scheduled_job_recurring_cron CHECK CHECK ((((kind)::text <> 'recurring_cron'::text) OR (("cronExpression" IS NOT NULL) AND ("recurrenceUnit" IS NOT NULL) AND ("recurrenceSize" IS NOT NULL))))
CHK_scheduled_job_timeoutSeconds CHECK CHECK ((("timeoutSeconds" > 0) AND ("timeoutSeconds" <= 2147483))) NOT VALID
PK_893185383f029ca8d57bb781fa8 PRIMARY KEY PRIMARY KEY (id)
scheduled_job_createdAt_not_null n NOT NULL "createdAt"
scheduled_job_enabled_not_null n NOT NULL enabled
scheduled_job_id_not_null n NOT NULL id
scheduled_job_kind_not_null n NOT NULL kind
scheduled_job_maxAttempts_not_null n NOT NULL "maxAttempts"
scheduled_job_misfireGraceSeconds_not_null n NOT NULL "misfireGraceSeconds"
scheduled_job_misfirePolicy_not_null n NOT NULL "misfirePolicy"
scheduled_job_name_not_null n NOT NULL name
scheduled_job_ownerId_not_null n NOT NULL "ownerId"
scheduled_job_ownerType_not_null n NOT NULL "ownerType"
scheduled_job_payload_not_null n NOT NULL payload
scheduled_job_taskType_not_null n NOT NULL "taskType"
scheduled_job_timeoutSeconds_not_null n NOT NULL "timeoutSeconds"
scheduled_job_updatedAt_not_null n NOT NULL "updatedAt"

索引

名称 定义
IDX_scheduled_job_concurrencyLimit CREATE INDEX "IDX_scheduled_job_concurrencyLimit" ON public.scheduled_job USING btree ("concurrencyLimit") WHERE ("concurrencyLimit" IS NOT NULL)
IDX_scheduled_job_name CREATE UNIQUE INDEX "IDX_scheduled_job_name" ON public.scheduled_job USING btree (name)
IDX_scheduled_job_nextRunAt CREATE INDEX "IDX_scheduled_job_nextRunAt" ON public.scheduled_job USING btree ("nextRunAt") WHERE ((enabled = true) AND ("nextRunAt" IS NOT NULL))
IDX_scheduled_job_ownerType_ownerId_ownerMemberId CREATE INDEX "IDX_scheduled_job_ownerType_ownerId_ownerMemberId" ON public.scheduled_job USING btree ("ownerType", "ownerId", "ownerMemberId")
PK_893185383f029ca8d57bb781fa8 CREATE UNIQUE INDEX "PK_893185383f029ca8d57bb781fa8" ON public.scheduled_job USING btree (id)

关系

erDiagram

"public.scheduled_task" }o--|| "public.scheduled_job" : "FOREIGN KEY (#quot;jobId#quot;) REFERENCES scheduled_job(id) ON DELETE CASCADE"

"public.scheduled_job" {
  integer concurrencyLimit
  timestamp_3__with_time_zone createdAt
  varchar_255_ cronExpression
  boolean enabled
  timestamp_3__with_time_zone fireAt
  integer id
  integer intervalSeconds
  varchar_16_ kind
  timestamp_3__with_time_zone lastDispatchedAt
  timestamp_3__with_time_zone lastFiredAt
  integer maxAttempts
  integer misfireGraceSeconds
  varchar_16_ misfirePolicy
  varchar_255_ name
  timestamp_3__with_time_zone nextRunAt
  timestamp_3__with_time_zone orphanedAt
  varchar_255_ ownerId
  varchar_64_ ownerMemberId
  varchar_32_ ownerType
  json payload
  integer recurrenceSize
  varchar_16_ recurrenceUnit
  varchar_128_ taskType
  integer timeoutSeconds
  varchar_64_ timezone
  timestamp_3__with_time_zone updatedAt
}
"public.scheduled_task" {
  integer attempts
  varchar_255_ claimedBy
  timestamp_3__with_time_zone createdAt
  timestamp_3__with_time_zone dispatchedAt
  text errorMessage
  timestamp_3__with_time_zone finishedAt
  bigint id
  integer jobId FK
  integer leaseEpoch
  timestamp_3__with_time_zone leaseExpiresAt
  integer maxAttempts
  timestamp_3__with_time_zone missedAfter
  json payload
  timestamp_3__with_time_zone runAt
  timestamp_3__with_time_zone scheduledFor
  timestamp_3__with_time_zone startedAt
  varchar_16_ status
  varchar_128_ taskType
  integer timeoutSeconds
}

由 tbls 生成

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 n8/n8n