-
Notifications
You must be signed in to change notification settings - Fork 0
/
hippo.ddl
384 lines (309 loc) · 10.7 KB
/
hippo.ddl
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
alter table Topics
drop
foreign key FK95A7C54424CD75BC;
alter table Topics
drop
foreign key FK95A7C544BFBBD543;
alter table Topics
drop
foreign key FK95A7C544D7A8CDDA;
alter table instancetable
drop
foreign key FKAEB83C59241F80B6;
alter table instancetable
drop
foreign key FKAEB83C59E7D2111;
alter table member_topics
drop
foreign key FKAF560A696E60CBA9;
alter table member_topics
drop
foreign key FKAF560A69978CE7C6;
alter table mind_tree
drop
foreign key FK2781EB6B4E230C15;
alter table mind_tree_elements
drop
foreign key FK440EAF4B1484FB6A;
alter table mind_tree_elements
drop
foreign key FK440EAF4BD40E47B5;
alter table mind_tree_elements
drop
foreign key FK440EAF4B4E230C15;
alter table occurrences
drop
foreign key FK2EC250C2B830444;
alter table occurrences
drop
foreign key FK2EC250C2BFBBD543;
alter table topic_associations
drop
foreign key FKD04875225C01F87F;
alter table topic_associations
drop
foreign key FKD048752227AACB23;
alter table topic_occurences
drop
foreign key FK6F7A6BACCEFD292F;
alter table topic_occurences
drop
foreign key FK6F7A6BAC479BD4A5;
alter table topic_scopes
drop
foreign key FK534459AF2A7FE1CC;
alter table topic_scopes
drop
foreign key FK534459AFE7D2111;
alter table typetable
drop
foreign key FK201420D4241F80B6;
alter table typetable
drop
foreign key FK201420D4E7D2111;
drop table if exists Topics;
drop table if exists Users;
drop table if exists instancetable;
drop table if exists mailing_list;
drop table if exists member_topics;
drop table if exists mind_tree;
drop table if exists mind_tree_elements;
drop table if exists occurrences;
drop table if exists subjects;
drop table if exists topic_associations;
drop table if exists topic_occurences;
drop table if exists topic_scopes;
drop table if exists typetable;
create table Topics (
topic_id bigint not null auto_increment,
discriminator varchar(255) not null,
user_id bigint,
title varchar(255) not null,
latitude integer not null,
longitude integer not null,
dateUpdated timestamp,
dateCreated timestamp,
public_visible tinyint(1),
subject bigint,
subject_id bigint,
`data` mediumtext collate utf8_bin,
`uri` varchar(2048) collate utf8_bin default NULL,
primary key (topic_id)
) type=InnoDB;
create table Users (
user_id bigint not null auto_increment,
user_name varchar(255) not null,
password varchar(255) not null,
`enabled` tinyint(1) NOT NULL default '1',
`supervisor` tinyint(1) NOT NULL default '0',
subscription_id BIGINT NOT NULL DEFAULT '0';
paypalID varchar(255) default NULL,
primary key (user_id)
) type=InnoDB;
create table Subscriptions (
subscription_id bigint not null auto_increment,
description varchar(255) not null,
price double not null,
maxTopics integer not null ,
primary key (subscription_id)
) type=InnoDB;
create table instancetable (
from_id bigint not null,
topic_id bigint not null,
primary key (from_id, topic_id)
) type=InnoDB;
create table mailing_list (
id bigint not null auto_increment,
email varchar(255),
userAgent varchar(255),
referer varchar(255),
host varchar(255),
primary key (id)
) type=InnoDB;
create table member_topics (
member_topics_id bigint not null,
member_id bigint not null,
primary key (member_topics_id, member_id)
) type=InnoDB;
create table mind_tree (
map_id bigint not null auto_increment,
topic bigint,
primary key (map_id)
) type=InnoDB;
create table mind_tree_elements (
tree_element_id bigint not null auto_increment,
title varchar(255),
topic bigint,
lft integer,
rgt integer,
left_map_id bigint,
right_map_id bigint,
primary key (tree_element_id)
) type=InnoDB;
create table occurrences (
occurrence_id bigint not null auto_increment,
discriminator varchar(255) not null,
user_id bigint,
title varchar(255),
data text,
dateUpdated timestamp,
dateCreated timestamp,
MindTree bigint,
uri varchar(2048),
primary key (occurrence_id)
) type=InnoDB;
create table subjects (
subject_id bigint not null auto_increment,
discriminator varchar(255) not null,
foreignID varchar(255),
name varchar(255),
primary key (subject_id)
) type=InnoDB;
create table topic_associations (
association_id bigint not null,
topic_id bigint not null,
primary key (association_id, topic_id)
) type=InnoDB;
CREATE TABLE `topic_occurences` (
`connector_id` bigint(20) NOT NULL auto_increment,
`occurrence_id` bigint(20) NOT NULL,
`topic_id` bigint(20) NOT NULL,
`latitude` int(11) NOT NULL default '-1',
`longitude` int(11) NOT NULL default '-1',
PRIMARY KEY (`connector_id`),
KEY `FK6F7A6BACCEFD292F` (`occurrence_id`),
KEY `FK6F7A6BAC479BD4A5` (`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=177 ;
create table topic_scopes (
topic_id bigint not null,
scope_id bigint not null,
primary key (topic_id, scope_id)
) type=InnoDB;
create table type_connector (
connector_id bigint not null auto_increment,
from_id bigint not null,
topic_id bigint not null,
`latitude` double NOT NULL default '-1',
`longitude` double NOT NULL default '-1',
primary key (connector_id)
) type=InnoDB;
alter table Users
add index UserSubIndex (subscription_id),
add constraint UserSubIndex
foreign key (subscription_id)
references Subscriptions (subscription_id);
alter table type_connector
add index fromIdx (from_id),
add constraint fromIdx
foreign key (from_id)
references Topics (topic_id);
alter table type_connector
add index topicIdx (topic_id),
add constraint topicIdx
foreign key (topic_id)
references Topics (topic_id);
alter table Topics
add index FK95A7C54424CD75BC (subject_id),
add constraint FK95A7C54424CD75BC
foreign key (subject_id)
references subjects (subject_id);
alter table Topics
add index FK95A7C544BFBBD543 (user_id),
add constraint FK95A7C544BFBBD543
foreign key (user_id)
references Users (user_id);
alter table Topics
add index FK95A7C544D7A8CDDA (subject),
add constraint FK95A7C544D7A8CDDA
foreign key (subject)
references subjects (subject_id);
alter table instancetable
add index FKAEB83C59241F80B6 (from_id),
add constraint FKAEB83C59241F80B6
foreign key (from_id)
references Topics (topic_id);
alter table instancetable
add index FKAEB83C59E7D2111 (topic_id),
add constraint FKAEB83C59E7D2111
foreign key (topic_id)
references Topics (topic_id);
alter table member_topics
add index FKAF560A696E60CBA9 (member_topics_id),
add constraint FKAF560A696E60CBA9
foreign key (member_topics_id)
references Topics (topic_id);
alter table member_topics
add index FKAF560A69978CE7C6 (member_id),
add constraint FKAF560A69978CE7C6
foreign key (member_id)
references Topics (topic_id);
alter table mind_tree
add index FK2781EB6B4E230C15 (topic),
add constraint FK2781EB6B4E230C15
foreign key (topic)
references Topics (topic_id);
alter table mind_tree_elements
add index FK440EAF4B1484FB6A (left_map_id),
add constraint FK440EAF4B1484FB6A
foreign key (left_map_id)
references mind_tree (map_id);
alter table mind_tree_elements
add index FK440EAF4BD40E47B5 (right_map_id),
add constraint FK440EAF4BD40E47B5
foreign key (right_map_id)
references mind_tree (map_id);
alter table mind_tree_elements
add index FK440EAF4B4E230C15 (topic),
add constraint FK440EAF4B4E230C15
foreign key (topic)
references Topics (topic_id);
alter table occurrences
add index FK2EC250C2B830444 (MindTree),
add constraint FK2EC250C2B830444
foreign key (MindTree)
references mind_tree (map_id);
alter table occurrences
add index FK2EC250C2BFBBD543 (user_id),
add constraint FK2EC250C2BFBBD543
foreign key (user_id)
references Users (user_id);
alter table topic_associations
add index FKD04875225C01F87F (association_id),
add constraint FKD04875225C01F87F
foreign key (association_id)
references Topics (topic_id);
alter table topic_associations
add index FKD048752227AACB23 (topic_id),
add constraint FKD048752227AACB23
foreign key (topic_id)
references Topics (topic_id);
alter table topic_occurences
add index FK6F7A6BACCEFD292F (occurrence_id),
add constraint FK6F7A6BACCEFD292F
foreign key (occurrence_id)
references Topics (topic_id);
alter table topic_occurences
add index FK6F7A6BAC479BD4A5 (topic_id),
add constraint FK6F7A6BAC479BD4A5
foreign key (topic_id)
references occurrences (occurrence_id);
alter table topic_scopes
add index FK534459AF2A7FE1CC (scope_id),
add constraint FK534459AF2A7FE1CC
foreign key (scope_id)
references Topics (topic_id);
alter table topic_scopes
add index FK534459AFE7D2111 (topic_id),
add constraint FK534459AFE7D2111
foreign key (topic_id)
references Topics (topic_id);
alter table typetable
add index FK201420D4241F80B6 (from_id),
add constraint FK201420D4241F80B6
foreign key (from_id)
references Topics (topic_id);
alter table typetable
add index FK201420D4E7D2111 (topic_id),
add constraint FK201420D4E7D2111
foreign key (topic_id)
references Topics (topic_id);