From 9456d27d7fdfb0f1a5c82ed50fd283f4d57c1e4b Mon Sep 17 00:00:00 2001 From: Kinan Dak Albab Date: Tue, 23 May 2023 19:38:00 -0400 Subject: [PATCH] Make all co-authors own the paper --- .../annotated/hotcrp-annotated.sql | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/experiments/schema-annot/annotated/hotcrp-annotated.sql b/experiments/schema-annot/annotated/hotcrp-annotated.sql index 846c7503..01cef5dc 100644 --- a/experiments/schema-annot/annotated/hotcrp-annotated.sql +++ b/experiments/schema-annot/annotated/hotcrp-annotated.sql @@ -1,6 +1,6 @@ --- not supported by k9db: +-- not supported by k9db: -- col types varbinary, blob, varchar --- multi column primary keys +-- multi column primary keys -- auto increment -- default values -- KEY / UNIQUE KEY @@ -90,11 +90,34 @@ CREATE TABLE Paper ( -- KEY shepherdContactId (shepherdContactId), FOREIGN KEY (paperStorageId) REFERENCES PaperStorage(paperStorageId), FOREIGN KEY (finalPaperStorageId) REFERENCES PaperStorage(paperStorageId), - FOREIGN KEY (leadContactId) OWNED_BY ContactInfo(contactId), + FOREIGN KEY (leadContactId) REFERENCES ONLY ContactInfo(contactId), FOREIGN KEY (shepherdContactId) ACCESSED_BY ContactInfo(contactId), FOREIGN KEY (managerContactId) ACCESSED_BY ContactInfo(contactId) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Added this table to work around issue #172. +-- Extracts co-author conflictType from PaperConflict +CREATE TABLE PaperAuthors ( + id int PRIMARY KEY NOT NULL, + paperId int NOT NULL, + contactId int NOT NULL, + FOREIGN KEY (paperId) OWNS Paper(paperId), + FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId) +) + +CREATE TABLE PaperConflict ( + id int PRIMARY KEY NOT NULL, + paperId int NOT NULL, + contactId int NOT NULL, + conflictType int NOT NULL, + FOREIGN KEY (paperId) ACCESSED_BY Paper(paperId), + -- see issue #172: ownership/edge in data ownership graph dependent on column value of conflictType, + -- which could be co-author, institutional, etc. + FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId), + ON DEL (paperId) DELETE_ROW +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE TABLE ActionLog ( logId int NOT NULL, contactId int NOT NULL, @@ -203,26 +226,6 @@ CREATE TABLE PaperComment ( FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE PaperConflict ( - id int PRIMARY KEY NOT NULL, - paperId int NOT NULL, - contactId int NOT NULL, - conflictType int NOT NULL, - FOREIGN KEY (paperId) REFERENCES Paper(paperId) - -- see issue #172: ownership/edge in data ownership graph dependent on column value of conflictType, - -- which could be co-author, institutional, etc. - -- FOREIGN KEY (contactId) REFERENCES ContactInfo(contactId) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- Added this table to work around issue #172. Extracts co-author conflictType from PaperConflict -CREATE TABLE PaperAuthors ( - id int PRIMARY KEY NOT NULL, - paperId int NOT NULL, - contactId int NOT NULL, - FOREIGN KEY (paperId) REFERENCES Paper(paperId), - FOREIGN KEY (contactId) OWNED_BY ContactInfo(contactId) -) - CREATE TABLE PaperOption ( id int PRIMARY KEY NOT NULL, paperId int NOT NULL, @@ -333,7 +336,7 @@ CREATE TABLE PaperTag ( CREATE TABLE PaperTagAnno ( -- # case-insensitive; see TAG_MAXLEN in init.php - tag text NOT NULL, + tag text NOT NULL, annoId int NOT NULL, tagIndex int NOT NULL, heading text, @@ -410,4 +413,4 @@ CREATE TABLE TopicInterest ( FOREIGN KEY (topicId) REFERENCES TopicArea(topicId) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -EXPLAIN COMPLIANCE; \ No newline at end of file +EXPLAIN COMPLIANCE;