2021-06-06 08:44:46 +00:00
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
|
2021-06-12 12:59:09 +00:00
|
|
|
CREATE TYPE fang_task_state AS ENUM ('new', 'in_progress', 'failed', 'finished');
|
|
|
|
|
2021-06-05 11:39:19 +00:00
|
|
|
CREATE TABLE fang_tasks (
|
2021-06-06 08:44:46 +00:00
|
|
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
|
|
metadata jsonb NOT NULL,
|
2021-06-12 12:59:09 +00:00
|
|
|
error_message TEXT,
|
|
|
|
state fang_task_state default 'new' NOT NULL,
|
2021-07-03 04:23:05 +00:00
|
|
|
task_type VARCHAR default 'common' NOT NULL,
|
2021-06-05 11:39:19 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
|
|
|
);
|
2021-06-12 12:59:09 +00:00
|
|
|
|
2021-06-23 10:48:03 +00:00
|
|
|
CREATE INDEX fang_tasks_state_index ON fang_tasks(state);
|
2021-07-03 04:23:05 +00:00
|
|
|
CREATE INDEX fang_tasks_type_index ON fang_tasks(task_type);
|
2021-06-12 12:59:09 +00:00
|
|
|
CREATE INDEX fang_tasks_created_at_index ON fang_tasks(created_at);
|
2021-07-18 19:09:30 +00:00
|
|
|
CREATE INDEX fang_tasks_metadata_index ON fang_tasks(metadata);
|