2023-03-07 15:41:20 +00:00
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
|
|
|
|
CREATE TABLE backie_tasks (
|
|
|
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
2023-03-10 22:41:34 +00:00
|
|
|
task_name VARCHAR NOT NULL,
|
|
|
|
queue_name VARCHAR DEFAULT 'common' NOT NULL,
|
2023-03-07 15:41:20 +00:00
|
|
|
uniq_hash CHAR(64) DEFAULT NULL,
|
2023-03-10 22:41:34 +00:00
|
|
|
payload jsonb NOT NULL,
|
|
|
|
timeout_msecs INT8 NOT NULL,
|
2023-03-07 15:41:20 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
2023-03-10 22:41:34 +00:00
|
|
|
scheduled_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
2023-03-07 15:41:20 +00:00
|
|
|
running_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
2023-03-10 22:41:34 +00:00
|
|
|
done_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
|
|
|
error_info jsonb DEFAULT NULL,
|
|
|
|
retries INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
max_retries INTEGER DEFAULT 0 NOT NULL
|
2023-03-07 15:41:20 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
--- create uniqueness index
|
|
|
|
CREATE UNIQUE INDEX backie_tasks_uniq_hash_index ON backie_tasks(uniq_hash) WHERE uniq_hash IS NOT NULL;
|