2020-01-23 17:53:26 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS tasks (
|
|
|
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
|
|
|
|
|
|
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
|
|
|
modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
|
|
|
completed_at timestamptz NULL DEFAULT NULL,
|
|
|
|
scheduled_at timestamptz NOT NULL,
|
|
|
|
|
2020-01-24 11:58:47 +01:00
|
|
|
queue text NOT NULL,
|
|
|
|
|
2020-01-23 17:53:26 +01:00
|
|
|
name text NOT NULL,
|
|
|
|
props bytea NOT NULL,
|
|
|
|
|
2020-01-24 11:58:47 +01:00
|
|
|
error text NULL DEFAULT NULL,
|
|
|
|
result bytea NULL DEFAULT NULL,
|
2020-01-23 20:38:21 +01:00
|
|
|
|
2020-01-23 17:53:26 +01:00
|
|
|
retry_num smallint NOT NULL DEFAULT 0,
|
|
|
|
status text NOT NULL DEFAULT 'new'
|
|
|
|
);
|
|
|
|
|
2020-01-24 11:58:47 +01:00
|
|
|
CREATE INDEX tasks__scheduled_at__queue__idx
|
2020-01-23 20:38:21 +01:00
|
|
|
ON tasks (scheduled_at, queue);
|