change schema
This commit is contained in:
parent
691cba40d4
commit
c24b92e349
5 changed files with 8 additions and 18 deletions
|
@ -1,2 +0,0 @@
|
|||
DROP TABLE fang_tasks;
|
||||
DROP TYPE fang_task_state;
|
|
@ -1 +0,0 @@
|
|||
DROP TABLE fang_periodic_tasks;
|
|
@ -1,11 +0,0 @@
|
|||
CREATE TABLE fang_periodic_tasks (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
metadata jsonb NOT NULL,
|
||||
period_in_millis BIGINT NOT NULL,
|
||||
scheduled_at TIMESTAMP WITH TIME ZONE,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX fang_periodic_tasks_scheduled_at_index ON fang_periodic_tasks(scheduled_at);
|
||||
CREATE INDEX fang_periodic_tasks_metadata_index ON fang_periodic_tasks(metadata);
|
1
migrations/2022-08-20-151615_create_fang_tasks/down.sql
Normal file
1
migrations/2022-08-20-151615_create_fang_tasks/down.sql
Normal file
|
@ -0,0 +1 @@
|
|||
-- This file should undo anything in `up.sql`
|
|
@ -6,13 +6,16 @@ CREATE TABLE fang_tasks (
|
|||
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
metadata jsonb NOT NULL,
|
||||
error_message TEXT,
|
||||
state fang_task_state default 'new' NOT NULL,
|
||||
task_type VARCHAR default 'common' NOT NULL,
|
||||
state fang_task_state DEFAULT 'new' NOT NULL,
|
||||
task_type VARCHAR DEFAULT 'common' NOT NULL,
|
||||
periodic BOOLEAN DEFAULT FALSE,
|
||||
uniq_hash CHAR(64),
|
||||
scheduled_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX fang_tasks_state_index ON fang_tasks(state);
|
||||
CREATE INDEX fang_tasks_type_index ON fang_tasks(task_type);
|
||||
CREATE INDEX fang_tasks_created_at_index ON fang_tasks(created_at);
|
||||
CREATE INDEX fang_tasks_metadata_index ON fang_tasks(metadata);
|
||||
CREATE INDEX fang_tasks_scheduled_at_index ON fang_tasks(scheduled_at);
|
||||
CREATE INDEX fang_tasks_uniq_hash ON fang_tasks(uniq_hash);
|
Loading…
Reference in a new issue