Skip to content

Commit

Permalink
add annotation dataset foreign key (#3482)
Browse files Browse the repository at this point in the history
* add annotation dataset foreign key and fix pull number from #3415

* add pr number to evolution and update migration #3482

* Update 035-add-annotation-dataset-foreign-key.sql

* Update 035-add-annotation-dataset-foreign-key.sql
  • Loading branch information
youri-k authored and fm3 committed Nov 22, 2018
1 parent 6f1e527 commit da1ad9b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
6 changes: 3 additions & 3 deletions MIGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ User-facing changes are documented in the [changelog](CHANGELOG.md).

## Unreleased
- If additional dataset directories were watched using the config key `additionalFolders`, those symlinks are no longer updated. Consider setting up additional datastores for these directories respectively.
-

### Postgres Evolutions:
- [033-tasktype-recommendedConfiguration.sql](033-tasktype-recommendedConfiguration.sql)
- [033-tasktype-recommendedConfiguration.sql](conf/evolutions/033-tasktype-recommendedConfiguration.sql)
- [034-meshes.sql](conf/evolutions/034-meshes.sql)

- [035-add-annotation-dataset-foreign-key.sql](conf/evolutions/035-add-annotation-dataset-foreign-key.sql)

## [18.11.0](https://github.com/scalableminds/webknossos/releases/tag/18.11.0) - 2018-10-29
- Some config keys have changed, if you overwrite them in your setup, please adapt: the `oxalis` prefix is renamed to `webKnossos` so the new keys are `webKnossos.user.time.tracingPauseInSeconds`, `webKnossos.tasks.maxOpenPerUser`, `webKnossos.newOrganizationMailingList` as well as `datastore.webKnossos.uri`, `datastore.webKnossos.secured`, `datastore.webKnossos.pingIntervalMinutes` for the data store.
Expand Down
10 changes: 10 additions & 0 deletions conf/evolutions/035-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/3482

START TRANSACTION;

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

UPDATE webknossos.releaseInformation SET schemaVersion = 35;

COMMIT TRANSACTION;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
START TRANSACTION;

ALTER TABLE webknossos.annotations
DROP CONSTRAINT dataSet_ref;

UPDATE webknossos.releaseInformation SET schemaVersion = 34;

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(34);
INSERT INTO webknossos.releaseInformation(schemaVersion) values(35);
COMMIT TRANSACTION;

CREATE TABLE webknossos.analytics(
Expand Down Expand Up @@ -340,7 +340,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.meshes
ADD CONSTRAINT annotation_ref FOREIGN KEY(_annotation) REFERENCES webknossos.annotations(_id) DEFERRABLE;
ALTER TABLE webknossos.dataSets
Expand Down

0 comments on commit da1ad9b

Please sign in to comment.