Commit 4869a58d51929f468eb1fa109bd5bebffda868d7

Removed DROP TABLE statements from schema file. Fixed errors with primary key definitions, too.
timApp/schema.sql
(5 / 34)
  
1
2DROP TABLE DocumentAccess
3;
4
5DROP TABLE BlockAccess
6;
7
8DROP TABLE UserGroupMembers
9;
10
11DROP TABLE ReadRevision
12;
13
14DROP TABLE DocumentBlocks
15;
16
17DROP TABLE Document
18;
19
20DROP TABLE User
21;
22
23DROP TABLE UserGroup
24;
25
26DROP TABLE Block
27;
28
29
301CREATE TABLE Block (
312id INTEGER NOT NULL,
323latest_revision_id INTEGER NULL,
4848Block_id INTEGER NOT NULL,
4949
5050CONSTRAINT DocumentBlocks_PK
51 PRIMARY KEY (Document_idBlock_id),
51 PRIMARY KEY (Document_id, Block_id),
5252CONSTRAINT DocumentBlocks_id
5353 FOREIGN KEY (Document_id)
5454 REFERENCES Document (id)
6969User_id INTEGER NOT NULL,
7070
7171CONSTRAINT ReadRevision_PK
72 PRIMARY KEY (Block_idUser_id),
72 PRIMARY KEY (Block_id, User_id),
7373CONSTRAINT ReadRevision_id
7474 FOREIGN KEY (Block_id)
7575 REFERENCES Block (id)
8989User_id INTEGER NOT NULL,
9090
9191CONSTRAINT UserGroupMembers_PK
92 PRIMARY KEY (UserGroup_idUser_id),
92 PRIMARY KEY (UserGroup_id, User_id),
9393CONSTRAINT UserGroupMembers_id
9494 FOREIGN KEY (UserGroup_id)
9595 REFERENCES UserGroup (id)
111111UserGroup_id INTEGER NOT NULL,
112112
113113CONSTRAINT BlockAccess_PK
114 PRIMARY KEY (Block_idUserGroup_id),
114 PRIMARY KEY (Block_id, UserGroup_id),
115115CONSTRAINT BlockAccess_id
116116 FOREIGN KEY (Block_id)
117117 REFERENCES Block (id)
133133UserGroup_id INTEGER NOT NULL,
134134
135135CONSTRAINT DocumentAccess_PK
136 PRIMARY KEY (Document_idUserGroup_id),
136 PRIMARY KEY (Document_id, UserGroup_id),
137137CONSTRAINT DocumentAccess_id
138138 FOREIGN KEY (Document_id)
139139 REFERENCES Document (id)