summaryrefslogtreecommitdiffstats
path: root/rust/migrations/2018-05-12-001226_init/up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'rust/migrations/2018-05-12-001226_init/up.sql')
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql25
1 files changed, 10 insertions, 15 deletions
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql
index 7550364c..a6384f4e 100644
--- a/rust/migrations/2018-05-12-001226_init/up.sql
+++ b/rust/migrations/2018-05-12-001226_init/up.sql
@@ -91,11 +91,10 @@ CREATE TABLE creator_edit (
rev_id UUID REFERENCES creator_rev(id),
redirect_id UUID REFERENCES creator_ident(id),
prev_rev UUID REFERENCES creator_rev(id),
- extra_json JSONB
+ extra_json JSONB,
+ UNIQUE (editgroup_id, ident_id)
);
-CREATE INDEX creator_edit_idx ON creator_edit(editgroup_id);
-
-------------------- Containers --------------------------------------------
CREATE TABLE container_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -132,11 +131,10 @@ CREATE TABLE container_edit (
rev_id UUID REFERENCES container_rev(id),
redirect_id UUID REFERENCES container_ident(id),
prev_rev UUID REFERENCES container_rev(id),
- extra_json JSONB
+ extra_json JSONB,
+ UNIQUE (editgroup_id, ident_id)
);
-CREATE INDEX container_edit_idx ON container_edit(editgroup_id);
-
-------------------- Files -------------------------------------------------
CREATE TABLE file_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -180,11 +178,10 @@ CREATE TABLE file_edit (
rev_id UUID REFERENCES file_rev(id),
redirect_id UUID REFERENCES file_ident(id),
prev_rev UUID REFERENCES file_rev(id),
- extra_json JSONB
+ extra_json JSONB,
+ UNIQUE (editgroup_id, ident_id)
);
-CREATE INDEX file_edit_idx ON file_edit(editgroup_id);
-
-------------------- Release -----------------------------------------------
CREATE TABLE release_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -248,11 +245,10 @@ CREATE TABLE release_edit (
rev_id UUID REFERENCES release_rev(id),
redirect_id UUID REFERENCES release_ident(id),
prev_rev UUID REFERENCES release_rev(id),
- extra_json JSONB
+ extra_json JSONB,
+ UNIQUE (editgroup_id, ident_id)
);
-CREATE INDEX release_edit_idx ON release_edit(editgroup_id);
-
-------------------- Works --------------------------------------------------
CREATE TABLE work_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -276,11 +272,10 @@ CREATE TABLE work_edit (
rev_id UUID REFERENCES work_rev(id),
redirect_id UUID REFERENCES work_ident(id),
prev_rev UUID REFERENCES work_rev(id),
- extra_json JSONB
+ extra_json JSONB,
+ UNIQUE (editgroup_id, ident_id)
);
-CREATE INDEX work_edit_idx ON work_edit(editgroup_id);
-
ALTER TABLE release_rev
ADD CONSTRAINT release_containeridentid_fkey FOREIGN KEY (work_ident_id)
REFERENCES work_ident(id);