Changeset 3217
- Timestamp:
- 07/31/13 16:15:15 (11 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql
r3216 r3217 162 162 163 163 164 165 -----------------------------------------------------------------------166 --------------------- JOINT TABLES ------------------------------------167 168 CREATE TABLE annotations_target_sources (169 annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id"170 source_id integer REFERENCES target_source(source_id),171 unique(annotation_id, source_id),172 );173 174 175 176 CREATE TABLE notebooks_annotations (177 notebook_id integer REFERENCES notebook(notebook_id),178 annotation_id integer REFERENCES annotation(annotation_id),179 unique(notebook_id, annotation_id),180 );181 182 CREATE TABLE sources_versions (183 source_id integer REFERENCES target_source(source_id),184 version_id integer REFERENCES version(version_id),185 unique(source_id, version_id),186 );187 188 CREATE TABLE versions_cached_representations (189 version_id integer REFERENCES version(version_id),190 cached_representation_id integer REFERENCES cached_representation_info(cached_representation_id),191 unique(version_id, cached_representation_id),192 );193 194 -------------------------------------------------------------------------------195 164 -------------------------------------------------------------------------------------------- 196 165 -- <xs:simpleType name="Permission"> … … 203 172 204 173 174 175 CREATE TABLE permission_ ( 176 permission_mode text UNIQUE NOT NULL, 177 ) 178 179 ----------------------------------------------------------------------- 180 --------------------- JOINT TABLES ------------------------------------ 181 182 CREATE TABLE annotations_target_sources ( 183 annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id" 184 source_id integer REFERENCES target_source(source_id), 185 unique(annotation_id, source_id), 186 ); 187 188 189 190 CREATE TABLE notebooks_annotations ( 191 notebook_id integer REFERENCES notebook(notebook_id), 192 annotation_id integer REFERENCES annotation(annotation_id), 193 unique(notebook_id, annotation_id), 194 ); 195 196 CREATE TABLE sources_versions ( 197 source_id integer REFERENCES target_source(source_id), 198 version_id integer REFERENCES version(version_id), 199 unique(source_id, version_id), 200 ); 201 202 CREATE TABLE versions_cached_representations ( 203 version_id integer REFERENCES version(version_id), 204 cached_representation_id integer REFERENCES cached_representation_info(cached_representation_id), 205 unique(version_id, cached_representation_id), 206 ); 207 208 ------------------------------------------------------------------------------- 209 210 205 211 -- <xs:complexType name="UserWithPermission"> 206 212 -- <xs:complexContent> … … 225 231 annotation_id integer REFERENCES annotation(annotation_id), 226 232 principal_id integer REFERENCES principal(principal_id), 227 permission_ text ,233 permission_ text REFERENCES permission_(permission_mode), 228 234 unique(annotation_id, principal_id), 229 CHECK(permission_ = 'reader' OR permission_='writer' OR permission_='owner'),230 235 -- 1 soundness: ??? owner in this table must be the same as the owner in the annotation table --- 231 236 -- 2 soundness ??? check for any pair (annotation, principal) there must be exactly one row in this table: -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql
r3216 r3217 142 142 ---- PERMISSIONS -------------------------------------------------------------------------------------------- 143 143 144 INSERT INTO permission_(permission_mode) VALUES ('owner'); 145 INSERT INTO permission_(permission_mode) VALUES ('writer'); 146 INSERT INTO permission_(permission_mode) VALUES ('reader'); 147 144 148 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 3, 'owner'); 145 149 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 4, 'writer');
Note: See TracChangeset
for help on using the changeset viewer.