Skip to content

Commit

Permalink
add annotation dataset foreign key and fix pull number from #3415
Browse files Browse the repository at this point in the history
  • Loading branch information
Youri K committed Nov 22, 2018
1 parent 07b13ed commit 5b784d9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf/evolutions/033-tasktype-recommendedConfiguration.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- https://github.com/scalableminds/webknossos/pull/TODO
-- https://github.com/scalableminds/webknossos/pull/3415

START TRANSACTION;

Expand Down
10 changes: 10 additions & 0 deletions conf/evolutions/034-add-annotation-dataset-foreign-key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- https://github.com/scalableminds/webknossos/pull/TODO

START TRANSACTION;

ALTER TABLE webknossos.annotations
ADD CONSTRAINT dataSet_ref FOREIGN KEY(_dataSet) REFERENCES webknossos.dataSets(_id) DEFERRABLE;

UPDATE webknossos.releaseInformation SET schemaVersion = 34;

COMMIT TRANSACTION;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- https://github.com/scalableminds/webknossos/pull/TODO

START TRANSACTION;

ALTER TABLE webknossos.annotations
DROP CONSTRAINT dataSet_ref;

UPDATE webknossos.releaseInformation SET schemaVersion = 33;

COMMIT TRANSACTION;
5 changes: 3 additions & 2 deletions tools/postgres/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ START TRANSACTION;
CREATE TABLE webknossos.releaseInformation (
schemaVersion BIGINT NOT NULL
);
INSERT INTO webknossos.releaseInformation(schemaVersion) values(33);
INSERT INTO webknossos.releaseInformation(schemaVersion) values(34);
COMMIT TRANSACTION;

CREATE TABLE webknossos.analytics(
Expand Down Expand Up @@ -329,7 +329,8 @@ ALTER TABLE webknossos.analytics
ALTER TABLE webknossos.annotations
ADD CONSTRAINT task_ref FOREIGN KEY(_task) REFERENCES webknossos.tasks(_id) ON DELETE SET NULL DEFERRABLE,
ADD CONSTRAINT team_ref FOREIGN KEY(_team) REFERENCES webknossos.teams(_id) DEFERRABLE,
ADD CONSTRAINT user_ref FOREIGN KEY(_user) REFERENCES webknossos.users(_id) DEFERRABLE;
ADD CONSTRAINT user_ref FOREIGN KEY(_user) REFERENCES webknossos.users(_id) DEFERRABLE,
ADD CONSTRAINT dataSet_ref FOREIGN KEY(_dataSet) REFERENCES webknossos.dataSets(_id) DEFERRABLE;
ALTER TABLE webknossos.dataSets
ADD CONSTRAINT organization_ref FOREIGN KEY(_organization) REFERENCES webknossos.organizations(_id) DEFERRABLE,
ADD CONSTRAINT dataStore_ref FOREIGN KEY(_dataStore) REFERENCES webknossos.dataStores(name) DEFERRABLE;
Expand Down

0 comments on commit 5b784d9

Please sign in to comment.