您可以从一个简单的表开始,该表具有以下用于存储计划的通用模式 (PostgreSQL)。考虑称为“作业”的调度运行的每个实例。
CREATE TABLE Schedule (
id SERIAL UNIQUE, -- unique identifier for the job
name varchar(64) NOT NULL, -- human readable name for the job
description text, -- details about the job
schedule varchar(64) NOT NULL, -- valid CRON expression for the job schedule
handler varchar(64) NOT NULL, -- string representing handler for the job
args text NOT NULL, -- arguments for the job handler
enabled boolean NOT NULL DEFAULT TRUE, -- whether the job should be run
created_at timestamp NOT NULL, -- when was the job created
updated_at timestamp NOT NULL, -- when was the job updated
start_date timestamp, -- job should not run until this time
end_date timestamp, -- job should not run after this time
last_triggered_at timestamp, -- when was the job last triggered
meta json -- additional metadata for the job
);