MySql_Tables.sql
9.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/**
* @filesource MySql_Tables.sql
*
* @category freeSN
* @copyright Copyright by mensch.coop e.G. 2009
* @mailto dev [at] mensch.coop
* @version 0.4.200901
* @link http://mensch.coop
*/
-- DROP DATABASE test;
-- CREATE DATABASE test;
-- use test
--
-- http://dev.mysql.com/doc/refman/5.1/de/storage-engines.html
--
-- Die Speicher-Engines InnoDB und BDB stellen transaktionssichere Tabellen zur Verfügung.
--
-- --------------------------------------------------------
-- Tabellen
select 'losp_BE_profile';
CREATE TABLE losp_BE_profile (
MTextID int(11) UNSIGNED NOT NULL,
NickName varchar(20) NOT NULL,
EMail varchar(256) NOT NULL,
Fingerprint varchar(42) NOT NULL,
Jabber varchar(256) NOT NULL,
Url varchar(2048),
OnlineState int(1) NOT NULL,
OnlineSince int(11),
Avatar varchar(2048),
Signature text(2048),
PRIMARY KEY (MTextID),
UNIQUE (NickName)
) ENGINE=InnoDB;
-- --------------------------------
select 'losp_be_account';
CREATE TABLE losp_be_account (
ID int(11) UNSIGNED NOT NULL auto_increment,
Password varchar(50) NOT NULL,
ProfileID int(11) UNSIGNED,
FirstName varchar(50) NOT NULL,
SurName varchar(100) NOT NULL,
Street varchar(100) NOT NULL,
Streetnumber int(4) NOT NULL,
City varchar(50) NOT NULL,
ZipCode int(5) NOT NULL,
EMail varchar(256) NOT NULL,
CDate timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
-- ------------------------
select 'losp_BasisElementDesign';
CREATE TABLE losp_BasisElementDesign (
ID int(11) UNSIGNED NOT NULL ,
BEClassName varchar(64) NOT NULL,
Author_ProfileID int(11) UNSIGNED,
CDate timestamp NOT NULL default CURRENT_TIMESTAMP,
CSS text NOT NULL,
Miscellaneous text NULL default NULL,
DefaultBC varchar(64) NULL default NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
--
select 'losp_BasisElementDesign_values';
CREATE TABLE losp_BasisElementDesign_values (
ID int(11) UNSIGNED NOT NULL ,
VKey varchar(128) NOT NULL,
VValue text NOT NULL,
PRIMARY KEY (ID, VKey)
) ENGINE=InnoDB;
--
select 'losp_BasisElement_categorynamelist';
CREATE TABLE losp_BasisElement_categorynamelist (
BECategoryID int(11) UNSIGNED NOT NULL,
BECategoryName varchar(64),
BECategoryGroupID int(11) UNSIGNED,
PRIMARY KEY (BECategoryID)
) ENGINE=InnoDB;
--
select 'losp_BasisElement_categorylist';
CREATE TABLE losp_BasisElement_categorylist (
BECategoryListID int(11) UNSIGNED NOT NULL,
BECategoryID int(11) UNSIGNED NOT NULL,
PRIMARY KEY (BECategoryListID,BECategoryID),
FOREIGN KEY (BECategoryID)
REFERENCES losp_BasisElement_categorynamelist(BECategoryID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
--
select 'losp_BasisElement_tagnamelist';
CREATE TABLE losp_BasisElement_tagnamelist (
TagID int(11) UNSIGNED NOT NULL,
TagName varchar(64),
PRIMARY KEY (TagID)
) ENGINE=InnoDB;
--
select 'losp_BasisElement_taglist';
CREATE TABLE losp_BasisElement_taglist (
TagListID int(11) UNSIGNED NOT NULL,
TagID int(11) UNSIGNED NOT NULL,
PRIMARY KEY (TagListID,TagID)
--
,
FOREIGN KEY (TagID)
REFERENCES losp_BasisElement_tagnamelist(TagID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
select 'losp_class';
CREATE TABLE losp_class (
ClassID int(11) UNSIGNED NOT NULL,
ClassName varchar(512),
PRIMARY KEY (ClassID)
) ENGINE=InnoDB;
--
select 'losp_BasisElement';
CREATE TABLE losp_BasisElement (
ID int(11) UNSIGNED NOT NULL,
Author_ProfileID int(11) UNSIGNED,
Subject varchar(512),
Text text NOT NULL,
CreateDate timestamp NOT NULL default CURRENT_TIMESTAMP,
TagListID int(11) UNSIGNED default null,
BECategoryListID int(11) UNSIGNED default null,
BECategoryChoiceBEID int(11) UNSIGNED default null,
BasisElementDesignID int(11) UNSIGNED default null,
AuthReadListID int(11) UNSIGNED default 0,
AuthWriteListID int(11) UNSIGNED default 0,
PCAuthReadListID int(11) UNSIGNED default 0,
PCAuthWriteListID int(11) UNSIGNED default 0,
ClassID int(11) UNSIGNED,
LanguageCode varchar(3),
PRIMARY KEY (ID),
INDEX (Author_ProfileID, AuthReadListID,AuthWriteListID,BasisElementDesignID, ClassID),
FOREIGN KEY (Author_ProfileID)
REFERENCES losp_BE_profile(MTextID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (BECategoryListID)
REFERENCES losp_BasisElement_categorylist(BECategoryListID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (BECategoryChoiceBEID)
REFERENCES losp_BasisElement(ID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (TagListID)
REFERENCES losp_BasisElement_taglist(TagListID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (BasisElementDesignID)
REFERENCES losp_BasisElementDesign(ID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (ClassID)
REFERENCES losp_class(ClassID)
ON DELETE SET NULL
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
--
select 'losp_BE_newsfeed';
CREATE TABLE losp_BE_newsfeed (
MTextID int(11) UNSIGNED NOT NULL,
Url varchar(2048),
PRIMARY KEY (MTextID)
--
,
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
--
select 'losp_BasisClipboard_state';
CREATE TABLE losp_BasisClipboard_state (
StateID int(4) UNSIGNED,
State varchar(128),
PRIMARY KEY (StateID)
) ENGINE=InnoDB;
--
select 'losp_BasisClipboard_objvar';
CREATE TABLE losp_BasisClipboard_objvar (
PartOfObjVarID int(4) UNSIGNED,
PartOfObjVar varchar(128),
PRIMARY KEY (PartOfObjVarID)
) ENGINE=InnoDB;
--
select 'losp_BasisClipboard_category';
CREATE TABLE losp_BasisClipboard_category (
CategoryID int(11) UNSIGNED,
CategoryName varchar(128),
PRIMARY KEY (CategoryID)
) ENGINE=InnoDB;
--
select 'losp_BasisClipboard';
CREATE TABLE losp_BasisClipboard (
PartOfID int(11) UNSIGNED NOT NULL,
PartOfObjVarID int(4) UNSIGNED,
AttachID int(11) UNSIGNED NOT NULL,
AttachStateID int(4) UNSIGNED,
LinkerProfileID int(11) UNSIGNED NOT NULL,
CategoryID int(11) UNSIGNED,
CDate timestamp NOT NULL default CURRENT_TIMESTAMP,
INDEX (PartOfID, PartOfObjVarID,AttachID, AttachStateID,LinkerProfileID,CategoryID),
PRIMARY KEY (PartOfID, AttachID, AttachStateID, PartOfObjVarID, CategoryID)
) ENGINE=InnoDB;
--
select 'losp_BasisElement_writeauthorisation';
CREATE TABLE losp_BasisElement_writeauthorisation (
ListID int(11) UNSIGNED NOT NULL ,
ProfileID int(11) UNSIGNED NOT NULL,
PRIMARY KEY (ListID,ProfileID),
INDEX (ProfileID),
FOREIGN KEY (ProfileID)
REFERENCES losp_BE_profile(MTextID)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;
--
select 'losp_BasisElement_readauthorisation';
CREATE TABLE losp_BasisElement_readauthorisation (
ListID int(11) UNSIGNED NOT NULL,
ProfileID int(11) UNSIGNED NOT NULL,
PRIMARY KEY (ListID,ProfileID),
INDEX (ProfileID),
FOREIGN KEY (ProfileID)
REFERENCES losp_BE_profile(MTextID)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;
--
select 'create losp_BE_date';
CREATE TABLE losp_BE_date (
MTextID int(11) UNSIGNED NOT NULL,
Start int(11),
End int(11),
Cycle int(3) NULL default NULL,
PRIMARY KEY (MTextID),
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;
--
select 'create losp_BE_topic';
CREATE TABLE losp_BE_topic (
MTextID int(11) UNSIGNED NOT NULL,
Name varchar(20),
PRIMARY KEY (MTextID)
) ENGINE=InnoDB;
alter table losp_BE_topic add unique (Name);
--
select 'create losp_BE_treepart';
CREATE TABLE losp_BE_treepart (
MTextID int(11) UNSIGNED NOT NULL,
Name varchar(20),
PRIMARY KEY (MTextID),
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
--
) ENGINE=InnoDB;
--
select 'losp_BE_file ';
CREATE TABLE losp_BE_file (
MTextID int(11) UNSIGNED NOT NULL,
Link varchar(512),
Mime varchar(20),
PRIMARY KEY (MTextID)
--
,
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
select 'losp_BE_url ';
CREATE TABLE losp_BE_url (
MTextID int(11) UNSIGNED NOT NULL,
Url varchar(2048),
PRIMARY KEY (MTextID)
--
,
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
select 'losp_BEBasisClipboardsRightManagement ';
CREATE TABLE IF NOT EXISTS losp_BEBasisClipboardsRightManagement (
PartOfID INT(11) UNSIGNED NOT NULL ,
PartOfObjVarID INT(4) UNSIGNED NOT NULL ,
CategoryID INT(11) UNSIGNED NOT NULL ,
WriteAuthorisaton CHAR(1),
ReadAuthorisation CHAR(1),
PRIMARY KEY (`PartOfID`, `PartOfObjVarID`, `CategoryID`),
INDEX `ID` (`PartOfID` ASC) ,
INDEX `PartOfObjVarID` (`PartOfObjVarID` ASC) ,
INDEX `CategroyID` (`CategoryID` ASC) ,
CONSTRAINT `ID`
FOREIGN KEY (`PartOfID` )
REFERENCES `losp_BasisElement` (`ID` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `PartOfObjVarID`
FOREIGN KEY (`PartOfObjVarID` )
REFERENCES `losp_BasisClipboard_objvar` (`PartOfObjVarID` )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `CategroyID`
FOREIGN KEY (`CategoryID` )
REFERENCES `losp_BasisClipboard_category` (`CategoryID` )
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE = InnoDB;
select 'losp_BE_threadmessage';
CREATE TABLE losp_BE_threadmessage (
MTextID int(11) UNSIGNED NOT NULL,
LastInsertDate int(11) UNSIGNED,
ThreadBEQuantity int(11) UNSIGNED,
PRIMARY KEY (MTextID),
FOREIGN KEY (MTextID)
REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE
ON UPDATE CASCADE
--
) ENGINE=InnoDB;
\. RightManagement/MySql_TableProfileCollectionAuthorisation.sql