Skip to content

Instantly share code, notes, and snippets.

@gifflet
Created September 20, 2023 20:48
Show Gist options
  • Save gifflet/10b93332432d26a528125420314f9d83 to your computer and use it in GitHub Desktop.
Save gifflet/10b93332432d26a528125420314f9d83 to your computer and use it in GitHub Desktop.
db-scheduler SQL init script
create table scheduled_tasks (
task_name text not null,
task_instance text not null,
task_data bytea,
execution_time timestamp with time zone not null,
picked BOOLEAN not null,
picked_by text,
last_success timestamp with time zone,
last_failure timestamp with time zone,
consecutive_failures INT,
last_heartbeat timestamp with time zone,
version BIGINT not null,
PRIMARY KEY (task_name, task_instance)
);
CREATE INDEX execution_time_idx ON scheduled_tasks (execution_time);
CREATE INDEX last_heartbeat_idx ON scheduled_tasks (last_heartbeat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment