From b75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 10 Jan 2019 21:36:59 -0800 Subject: SQL for annotations; editgroup is_accepted flag is_accepted won't be implemented, much, for a bit. --- rust/migrations/2019-01-01-000000_init/up.sql | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'rust/migrations') diff --git a/rust/migrations/2019-01-01-000000_init/up.sql b/rust/migrations/2019-01-01-000000_init/up.sql index a3dd13a5..30af7879 100644 --- a/rust/migrations/2019-01-01-000000_init/up.sql +++ b/rust/migrations/2019-01-01-000000_init/up.sql @@ -45,11 +45,26 @@ CREATE TABLE editgroup ( id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), editor_id UUID REFERENCES editor(id) NOT NULL, created TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL, + submitted TIMESTAMP WITH TIME ZONE, + is_accepted BOOLEAN DEFAULT false NOT NULL, extra_json JSONB, description TEXT ); -CREATE INDEX editgroup_created_idx ON editgroup(created); +-- for fast "recent, reviewable" and "work in progress" queries +CREATE INDEX editgroup_submitted_idx ON editgroup(is_accepted, submitted); +CREATE INDEX editgroup_editor_idx ON editgroup(is_accepted, editor_id); + +CREATE TABLE editgroup_annotation ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + editgroup_id UUID REFERENCES editgroup(id) NOT NULL, + editor_id UUID REFERENCES editor(id) NOT NULL, + created TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL, + comment_markdown TEXT, + extra_json JSONB +); + +CREATE INDEX editgroup_annotation_created_idx ON editgroup_annotation(editgroup_id, created); CREATE TABLE changelog ( id BIGSERIAL PRIMARY KEY, -- cgit v1.2.3