diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-10 21:36:59 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-10 21:37:02 -0800 |
commit | b75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae (patch) | |
tree | f6db93cedab84721dd174b472f7d505627bc1f8e /rust/migrations/2019-01-01-000000_init/up.sql | |
parent | 42d73fb7da872eee94325ae8412a66b1f6e5adf9 (diff) | |
download | fatcat-b75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae.tar.gz fatcat-b75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae.zip |
SQL for annotations; editgroup is_accepted flag
is_accepted won't be implemented, much, for a bit.
Diffstat (limited to 'rust/migrations/2019-01-01-000000_init/up.sql')
-rw-r--r-- | rust/migrations/2019-01-01-000000_init/up.sql | 17 |
1 files changed, 16 insertions, 1 deletions
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, |