Project

General

Profile

« Previous | Next » 

Revision 8522

schemas/VegCore/VegCore.my.sql: removed default_schema qualifier from names because all objects are in the same schema

View differences:

schemas/VegCore/VegCore.my.sql
2 2
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3 3
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
4 4

  
5
CREATE SCHEMA IF NOT EXISTS `default_schema` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
6
USE `default_schema` ;
7 5

  
8 6
-- -----------------------------------------------------
9
-- Table `default_schema`.`source`
7
-- Table `source`
10 8
-- -----------------------------------------------------
11
CREATE  TABLE IF NOT EXISTS `default_schema`.`source` (
9
CREATE  TABLE IF NOT EXISTS `source` (
12 10
  `source` TEXT NOT NULL ,
13 11
  `source_parent` TEXT NULL DEFAULT NULL ,
14 12
  PRIMARY KEY (`source`) ,
15 13
  INDEX `fk_source1` (`source_parent` ASC) ,
16 14
  CONSTRAINT `fk_source1`
17 15
    FOREIGN KEY (`source_parent` )
18
    REFERENCES `default_schema`.`source` (`source` )
16
    REFERENCES `source` (`source` )
19 17
    ON DELETE NO ACTION
20 18
    ON UPDATE NO ACTION)
21 19
ENGINE = InnoDB
......
24 22

  
25 23

  
26 24
-- -----------------------------------------------------
27
-- Table `default_schema`.`record`
25
-- Table `record`
28 26
-- -----------------------------------------------------
29
CREATE  TABLE IF NOT EXISTS `default_schema`.`record` (
27
CREATE  TABLE IF NOT EXISTS `record` (
30 28
  `record` TEXT NOT NULL ,
31 29
  `source` TEXT NOT NULL ,
32 30
  PRIMARY KEY (`record`) ,
33 31
  INDEX `fk_record_source1` (`source` ASC) ,
34 32
  CONSTRAINT `fk_record_source1`
35 33
    FOREIGN KEY (`source` )
36
    REFERENCES `default_schema`.`source` (`source` )
34
    REFERENCES `source` (`source` )
37 35
    ON DELETE NO ACTION
38 36
    ON UPDATE NO ACTION)
39 37
ENGINE = InnoDB
......
42 40

  
43 41

  
44 42
-- -----------------------------------------------------
45
-- Table `default_schema`.`relationship`
43
-- Table `relationship`
46 44
-- -----------------------------------------------------
47
CREATE  TABLE IF NOT EXISTS `default_schema`.`relationship` (
45
CREATE  TABLE IF NOT EXISTS `relationship` (
48 46
  `relationship` TEXT NOT NULL ,
49 47
  `record` TEXT NOT NULL ,
50 48
  `related_record` TEXT NOT NULL ,
......
53 51
  INDEX `fk_relationship_related_record` (`related_record` ASC) ,
54 52
  CONSTRAINT `fk_relationship_record1`
55 53
    FOREIGN KEY (`relationship` )
56
    REFERENCES `default_schema`.`record` (`record` )
54
    REFERENCES `record` (`record` )
57 55
    ON DELETE CASCADE
58 56
    ON UPDATE CASCADE,
59 57
  CONSTRAINT `fk_relationship_record1`
60 58
    FOREIGN KEY (`record` )
61
    REFERENCES `default_schema`.`record` (`record` )
59
    REFERENCES `record` (`record` )
62 60
    ON DELETE NO ACTION
63 61
    ON UPDATE NO ACTION,
64 62
  CONSTRAINT `fk_relationship_related_record`
65 63
    FOREIGN KEY (`related_record` )
66
    REFERENCES `default_schema`.`record` (`record` )
64
    REFERENCES `record` (`record` )
67 65
    ON DELETE NO ACTION
68 66
    ON UPDATE NO ACTION)
69 67
ENGINE = InnoDB
......
72 70

  
73 71

  
74 72
-- -----------------------------------------------------
75
-- Table `default_schema`.`taxon`
73
-- Table `taxon`
76 74
-- -----------------------------------------------------
77
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon` (
75
CREATE  TABLE IF NOT EXISTS `taxon` (
78 76
  `taxon` TEXT NOT NULL ,
79 77
  `taxon_parent` TEXT NULL ,
80 78
  PRIMARY KEY (`taxon`) ,
81 79
  INDEX `fk_taxon_taxon1` (`taxon_parent` ASC) ,
82 80
  CONSTRAINT `fk_taxon_record1`
83 81
    FOREIGN KEY (`taxon` )
84
    REFERENCES `default_schema`.`record` (`record` )
82
    REFERENCES `record` (`record` )
85 83
    ON DELETE CASCADE
86 84
    ON UPDATE CASCADE,
87 85
  CONSTRAINT `fk_taxon_taxon1`
88 86
    FOREIGN KEY (`taxon_parent` )
89
    REFERENCES `default_schema`.`taxon` (`taxon` )
87
    REFERENCES `taxon` (`taxon` )
90 88
    ON DELETE NO ACTION
91 89
    ON UPDATE NO ACTION)
92 90
ENGINE = InnoDB
......
95 93

  
96 94

  
97 95
-- -----------------------------------------------------
98
-- Table `default_schema`.`taxon_assertion`
96
-- Table `taxon_assertion`
99 97
-- -----------------------------------------------------
100
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_assertion` (
98
CREATE  TABLE IF NOT EXISTS `taxon_assertion` (
101 99
  `taxon_assertion` TEXT NOT NULL ,
102 100
  `taxon` TEXT NOT NULL ,
103 101
  PRIMARY KEY (`taxon_assertion`) ,
104 102
  INDEX `fk_qualified_taxon_name_taxon1` (`taxon` ASC) ,
105 103
  CONSTRAINT `fk_qualified_taxon_record1`
106 104
    FOREIGN KEY (`taxon_assertion` )
107
    REFERENCES `default_schema`.`record` (`record` )
105
    REFERENCES `record` (`record` )
108 106
    ON DELETE CASCADE
109 107
    ON UPDATE CASCADE,
110 108
  CONSTRAINT `fk_qualified_taxon_name_taxon1`
111 109
    FOREIGN KEY (`taxon` )
112
    REFERENCES `default_schema`.`taxon` (`taxon` )
110
    REFERENCES `taxon` (`taxon` )
113 111
    ON DELETE NO ACTION
114 112
    ON UPDATE NO ACTION)
115 113
ENGINE = InnoDB
......
118 116

  
119 117

  
120 118
-- -----------------------------------------------------
121
-- Table `default_schema`.`taxon_determination`
119
-- Table `taxon_determination`
122 120
-- -----------------------------------------------------
123
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_determination` (
121
CREATE  TABLE IF NOT EXISTS `taxon_determination` (
124 122
  `taxon_determination` VARCHAR(45) NOT NULL ,
125 123
  `taxon_occurrence` TEXT NOT NULL ,
126 124
  `qualified_taxon` TEXT NOT NULL ,
......
129 127
  PRIMARY KEY (`taxon_determination`) ,
130 128
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon_occurrence1`
131 129
    FOREIGN KEY (`taxon_occurrence` )
132
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
130
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
133 131
    ON DELETE NO ACTION
134 132
    ON UPDATE NO ACTION,
135 133
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon1`
136 134
    FOREIGN KEY (`qualified_taxon` )
137
    REFERENCES `default_schema`.`taxon_assertion` (`taxon_assertion` )
135
    REFERENCES `taxon_assertion` (`taxon_assertion` )
138 136
    ON DELETE NO ACTION
139 137
    ON UPDATE NO ACTION,
140 138
  CONSTRAINT `fk_taxon_determination_record1`
141 139
    FOREIGN KEY (`taxon_determination` )
142
    REFERENCES `default_schema`.`record` (`record` )
140
    REFERENCES `record` (`record` )
143 141
    ON DELETE NO ACTION
144 142
    ON UPDATE NO ACTION)
145 143
ENGINE = InnoDB
......
148 146

  
149 147

  
150 148
-- -----------------------------------------------------
151
-- Table `default_schema`.`coordinates`
149
-- Table `coordinates`
152 150
-- -----------------------------------------------------
153
CREATE  TABLE IF NOT EXISTS `default_schema`.`coordinates` (
151
CREATE  TABLE IF NOT EXISTS `coordinates` (
154 152
  `coordinates` TEXT NOT NULL ,
155 153
  PRIMARY KEY (`coordinates`) ,
156 154
  CONSTRAINT `fk_coordinates_record1`
157 155
    FOREIGN KEY (`coordinates` )
158
    REFERENCES `default_schema`.`record` (`record` )
156
    REFERENCES `record` (`record` )
159 157
    ON DELETE CASCADE
160 158
    ON UPDATE CASCADE)
161 159
ENGINE = InnoDB
......
164 162

  
165 163

  
166 164
-- -----------------------------------------------------
167
-- Table `default_schema`.`named_place`
165
-- Table `named_place`
168 166
-- -----------------------------------------------------
169
CREATE  TABLE IF NOT EXISTS `default_schema`.`named_place` (
167
CREATE  TABLE IF NOT EXISTS `named_place` (
170 168
  `named_place` TEXT NOT NULL ,
171 169
  PRIMARY KEY (`named_place`) ,
172 170
  CONSTRAINT `fk_named_place_record1`
173 171
    FOREIGN KEY (`named_place` )
174
    REFERENCES `default_schema`.`record` (`record` )
172
    REFERENCES `record` (`record` )
175 173
    ON DELETE CASCADE
176 174
    ON UPDATE CASCADE)
177 175
ENGINE = InnoDB
......
180 178

  
181 179

  
182 180
-- -----------------------------------------------------
183
-- Table `default_schema`.`location`
181
-- Table `location`
184 182
-- -----------------------------------------------------
185
CREATE  TABLE IF NOT EXISTS `default_schema`.`location` (
183
CREATE  TABLE IF NOT EXISTS `location` (
186 184
  `location` TEXT NOT NULL ,
187 185
  `location_parent` TEXT NULL DEFAULT NULL ,
188 186
  `named_place` TEXT NULL DEFAULT NULL ,
......
193 191
  INDEX `fk_location1` (`location_parent` ASC) ,
194 192
  CONSTRAINT `fk_location_record1`
195 193
    FOREIGN KEY (`location` )
196
    REFERENCES `default_schema`.`record` (`record` )
194
    REFERENCES `record` (`record` )
197 195
    ON DELETE CASCADE
198 196
    ON UPDATE CASCADE,
199 197
  CONSTRAINT `fk_location_coordinates1`
200 198
    FOREIGN KEY (`coordinates` )
201
    REFERENCES `default_schema`.`coordinates` (`coordinates` )
199
    REFERENCES `coordinates` (`coordinates` )
202 200
    ON DELETE NO ACTION
203 201
    ON UPDATE NO ACTION,
204 202
  CONSTRAINT `fk_location_placename1`
205 203
    FOREIGN KEY (`named_place` )
206
    REFERENCES `default_schema`.`named_place` (`named_place` )
204
    REFERENCES `named_place` (`named_place` )
207 205
    ON DELETE NO ACTION
208 206
    ON UPDATE NO ACTION,
209 207
  CONSTRAINT `fk_location1`
210 208
    FOREIGN KEY (`location_parent` )
211
    REFERENCES `default_schema`.`location` (`location` )
209
    REFERENCES `location` (`location` )
212 210
    ON DELETE NO ACTION
213 211
    ON UPDATE NO ACTION)
214 212
ENGINE = InnoDB
......
217 215

  
218 216

  
219 217
-- -----------------------------------------------------
220
-- Table `default_schema`.`method`
218
-- Table `method`
221 219
-- -----------------------------------------------------
222
CREATE  TABLE IF NOT EXISTS `default_schema`.`method` (
220
CREATE  TABLE IF NOT EXISTS `method` (
223 221
  `method` TEXT NOT NULL ,
224 222
  PRIMARY KEY (`method`) ,
225 223
  CONSTRAINT `fk_method_record1`
226 224
    FOREIGN KEY (`method` )
227
    REFERENCES `default_schema`.`record` (`record` )
225
    REFERENCES `record` (`record` )
228 226
    ON DELETE CASCADE
229 227
    ON UPDATE CASCADE)
230 228
ENGINE = InnoDB
......
233 231

  
234 232

  
235 233
-- -----------------------------------------------------
236
-- Table `default_schema`.`event`
234
-- Table `event`
237 235
-- -----------------------------------------------------
238
CREATE  TABLE IF NOT EXISTS `default_schema`.`event` (
236
CREATE  TABLE IF NOT EXISTS `event` (
239 237
  `event` TEXT NOT NULL ,
240 238
  `event_parent` TEXT NULL DEFAULT NULL ,
241 239
  `location` TEXT NULL DEFAULT NULL ,
......
246 244
  INDEX `fk_event_method1` (`method` ASC) ,
247 245
  CONSTRAINT `fk_event_record1`
248 246
    FOREIGN KEY (`event` )
249
    REFERENCES `default_schema`.`record` (`record` )
247
    REFERENCES `record` (`record` )
250 248
    ON DELETE CASCADE
251 249
    ON UPDATE CASCADE,
252 250
  CONSTRAINT `fk_event_location1`
253 251
    FOREIGN KEY (`location` )
254
    REFERENCES `default_schema`.`location` (`location` )
252
    REFERENCES `location` (`location` )
255 253
    ON DELETE NO ACTION
256 254
    ON UPDATE NO ACTION,
257 255
  CONSTRAINT `fk_event1`
258 256
    FOREIGN KEY (`event_parent` )
259
    REFERENCES `default_schema`.`event` (`event` )
257
    REFERENCES `event` (`event` )
260 258
    ON DELETE NO ACTION
261 259
    ON UPDATE NO ACTION,
262 260
  CONSTRAINT `fk_event_method1`
263 261
    FOREIGN KEY (`method` )
264
    REFERENCES `default_schema`.`method` (`method` )
262
    REFERENCES `method` (`method` )
265 263
    ON DELETE NO ACTION
266 264
    ON UPDATE NO ACTION)
267 265
ENGINE = InnoDB
......
270 268

  
271 269

  
272 270
-- -----------------------------------------------------
273
-- Table `default_schema`.`taxon_occurrence`
271
-- Table `taxon_occurrence`
274 272
-- -----------------------------------------------------
275
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_occurrence` (
273
CREATE  TABLE IF NOT EXISTS `taxon_occurrence` (
276 274
  `taxon_occurrence` TEXT NOT NULL ,
277 275
  `current_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
278 276
  `original_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
......
281 279
  INDEX `fk_taxon_occurrence_event1` (`taxon_occurrence` ASC) ,
282 280
  CONSTRAINT `fk_taxon_occurrence_taxon_determination1`
283 281
    FOREIGN KEY (`original_taxon_determination` )
284
    REFERENCES `default_schema`.`taxon_determination` (`taxon_determination` )
282
    REFERENCES `taxon_determination` (`taxon_determination` )
285 283
    ON DELETE NO ACTION
286 284
    ON UPDATE NO ACTION,
287 285
  CONSTRAINT `fk_taxon_occurrence_taxon_determination2`
288 286
    FOREIGN KEY (`current_taxon_determination` )
289
    REFERENCES `default_schema`.`taxon_determination` (`taxon_determination` )
287
    REFERENCES `taxon_determination` (`taxon_determination` )
290 288
    ON DELETE NO ACTION
291 289
    ON UPDATE NO ACTION,
292 290
  CONSTRAINT `fk_taxon_occurrence_event1`
293 291
    FOREIGN KEY (`taxon_occurrence` )
294
    REFERENCES `default_schema`.`event` (`event` )
292
    REFERENCES `event` (`event` )
295 293
    ON DELETE NO ACTION
296 294
    ON UPDATE NO ACTION)
297 295
ENGINE = InnoDB
......
300 298

  
301 299

  
302 300
-- -----------------------------------------------------
303
-- Table `default_schema`.`trait`
301
-- Table `trait`
304 302
-- -----------------------------------------------------
305
CREATE  TABLE IF NOT EXISTS `default_schema`.`trait` (
303
CREATE  TABLE IF NOT EXISTS `trait` (
306 304
  `trait` TEXT NOT NULL ,
307 305
  `taxon_occurrence` TEXT NOT NULL ,
308 306
  PRIMARY KEY (`trait`) ,
309 307
  INDEX `fk_trait_taxon_occurrence1` (`taxon_occurrence` ASC) ,
310 308
  CONSTRAINT `fk_measurement_record1`
311 309
    FOREIGN KEY (`trait` )
312
    REFERENCES `default_schema`.`record` (`record` )
310
    REFERENCES `record` (`record` )
313 311
    ON DELETE CASCADE
314 312
    ON UPDATE CASCADE,
315 313
  CONSTRAINT `fk_trait_taxon_occurrence1`
316 314
    FOREIGN KEY (`taxon_occurrence` )
317
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
315
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
318 316
    ON DELETE NO ACTION
319 317
    ON UPDATE NO ACTION)
320 318
ENGINE = InnoDB
......
323 321

  
324 322

  
325 323
-- -----------------------------------------------------
326
-- Table `default_schema`.`collection`
324
-- Table `collection`
327 325
-- -----------------------------------------------------
328
CREATE  TABLE IF NOT EXISTS `default_schema`.`collection` (
326
CREATE  TABLE IF NOT EXISTS `collection` (
329 327
  `collection` TEXT NOT NULL ,
330 328
  PRIMARY KEY (`collection`) ,
331 329
  CONSTRAINT `fk_collection_source1`
332 330
    FOREIGN KEY (`collection` )
333
    REFERENCES `default_schema`.`source` (`source` )
331
    REFERENCES `source` (`source` )
334 332
    ON DELETE NO ACTION
335 333
    ON UPDATE NO ACTION)
336 334
ENGINE = InnoDB
......
339 337

  
340 338

  
341 339
-- -----------------------------------------------------
342
-- Table `default_schema`.`specimen`
340
-- Table `specimen`
343 341
-- -----------------------------------------------------
344
CREATE  TABLE IF NOT EXISTS `default_schema`.`specimen` (
342
CREATE  TABLE IF NOT EXISTS `specimen` (
345 343
  `specimen` TEXT NOT NULL ,
346 344
  `collection` TEXT NOT NULL ,
347 345
  PRIMARY KEY (`specimen`) ,
348 346
  INDEX `fk_specimen_collection1` (`collection` ASC) ,
349 347
  CONSTRAINT `fk_specimen_taxon_occurrence1`
350 348
    FOREIGN KEY (`specimen` )
351
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
349
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
352 350
    ON DELETE NO ACTION
353 351
    ON UPDATE NO ACTION,
354 352
  CONSTRAINT `fk_specimen_collection1`
355 353
    FOREIGN KEY (`collection` )
356
    REFERENCES `default_schema`.`collection` (`collection` )
354
    REFERENCES `collection` (`collection` )
357 355
    ON DELETE NO ACTION
358 356
    ON UPDATE NO ACTION)
359 357
ENGINE = InnoDB
......
362 360

  
363 361

  
364 362
-- -----------------------------------------------------
365
-- Table `default_schema`.`voucher`
363
-- Table `voucher`
366 364
-- -----------------------------------------------------
367
CREATE  TABLE IF NOT EXISTS `default_schema`.`voucher` (
365
CREATE  TABLE IF NOT EXISTS `voucher` (
368 366
  `voucher` TEXT NOT NULL ,
369 367
  `taxon_occurrence` TEXT NOT NULL ,
370 368
  `specimen` TEXT NOT NULL ,
......
373 371
  INDEX `fk_voucher_specimen1` (`specimen` ASC) ,
374 372
  CONSTRAINT `fk_voucher_record1`
375 373
    FOREIGN KEY (`voucher` )
376
    REFERENCES `default_schema`.`record` (`record` )
374
    REFERENCES `record` (`record` )
377 375
    ON DELETE CASCADE
378 376
    ON UPDATE CASCADE,
379 377
  CONSTRAINT `fk_voucher_taxon_occurrence1`
380 378
    FOREIGN KEY (`taxon_occurrence` )
381
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
379
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
382 380
    ON DELETE NO ACTION
383 381
    ON UPDATE NO ACTION,
384 382
  CONSTRAINT `fk_voucher_specimen1`
385 383
    FOREIGN KEY (`specimen` )
386
    REFERENCES `default_schema`.`specimen` (`specimen` )
384
    REFERENCES `specimen` (`specimen` )
387 385
    ON DELETE NO ACTION
388 386
    ON UPDATE NO ACTION)
389 387
ENGINE = InnoDB
......
392 390

  
393 391

  
394 392
-- -----------------------------------------------------
395
-- Table `default_schema`.`individual`
393
-- Table `individual`
396 394
-- -----------------------------------------------------
397
CREATE  TABLE IF NOT EXISTS `default_schema`.`individual` (
395
CREATE  TABLE IF NOT EXISTS `individual` (
398 396
  `individual` TEXT NOT NULL ,
399 397
  PRIMARY KEY (`individual`) ,
400 398
  CONSTRAINT `fk_individual_record1`
401 399
    FOREIGN KEY (`individual` )
402
    REFERENCES `default_schema`.`record` (`record` )
400
    REFERENCES `record` (`record` )
403 401
    ON DELETE CASCADE
404 402
    ON UPDATE CASCADE)
405 403
ENGINE = InnoDB
......
408 406

  
409 407

  
410 408
-- -----------------------------------------------------
411
-- Table `default_schema`.`individual_observation`
409
-- Table `individual_observation`
412 410
-- -----------------------------------------------------
413
CREATE  TABLE IF NOT EXISTS `default_schema`.`individual_observation` (
411
CREATE  TABLE IF NOT EXISTS `individual_observation` (
414 412
  `individual_observation` TEXT NOT NULL ,
415 413
  `individual` TEXT NOT NULL ,
416 414
  PRIMARY KEY (`individual_observation`) ,
417 415
  INDEX `fk_individual_observation_individual1` (`individual` ASC) ,
418 416
  CONSTRAINT `fk_individual_observation_taxon_occurrence1`
419 417
    FOREIGN KEY (`individual_observation` )
420
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
418
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
421 419
    ON DELETE NO ACTION
422 420
    ON UPDATE NO ACTION,
423 421
  CONSTRAINT `fk_individual_observation_individual1`
424 422
    FOREIGN KEY (`individual` )
425
    REFERENCES `default_schema`.`individual` (`individual` )
423
    REFERENCES `individual` (`individual` )
426 424
    ON DELETE NO ACTION
427 425
    ON UPDATE NO ACTION)
428 426
ENGINE = InnoDB
......
431 429

  
432 430

  
433 431
-- -----------------------------------------------------
434
-- Table `default_schema`.`stem`
432
-- Table `stem`
435 433
-- -----------------------------------------------------
436
CREATE  TABLE IF NOT EXISTS `default_schema`.`stem` (
434
CREATE  TABLE IF NOT EXISTS `stem` (
437 435
  `stem` TEXT NOT NULL ,
438 436
  `individual` TEXT NOT NULL ,
439 437
  PRIMARY KEY (`stem`) ,
440 438
  INDEX `fk_stem_individual1` (`individual` ASC) ,
441 439
  CONSTRAINT `fk_stem_record1`
442 440
    FOREIGN KEY (`stem` )
443
    REFERENCES `default_schema`.`record` (`record` )
441
    REFERENCES `record` (`record` )
444 442
    ON DELETE CASCADE
445 443
    ON UPDATE CASCADE,
446 444
  CONSTRAINT `fk_stem_individual1`
447 445
    FOREIGN KEY (`individual` )
448
    REFERENCES `default_schema`.`individual` (`individual` )
446
    REFERENCES `individual` (`individual` )
449 447
    ON DELETE NO ACTION
450 448
    ON UPDATE NO ACTION)
451 449
ENGINE = InnoDB
......
454 452

  
455 453

  
456 454
-- -----------------------------------------------------
457
-- Table `default_schema`.`stem_observation`
455
-- Table `stem_observation`
458 456
-- -----------------------------------------------------
459
CREATE  TABLE IF NOT EXISTS `default_schema`.`stem_observation` (
457
CREATE  TABLE IF NOT EXISTS `stem_observation` (
460 458
  `stem_observation` TEXT NOT NULL ,
461 459
  `individual_observation` TEXT NOT NULL ,
462 460
  `stem` TEXT NOT NULL ,
......
465 463
  INDEX `fk_stem_observation_stem1` (`stem` ASC) ,
466 464
  CONSTRAINT `fk_stem_observation_record1`
467 465
    FOREIGN KEY (`stem_observation` )
468
    REFERENCES `default_schema`.`record` (`record` )
466
    REFERENCES `record` (`record` )
469 467
    ON DELETE CASCADE
470 468
    ON UPDATE CASCADE,
471 469
  CONSTRAINT `fk_stem_observation_individual_observation1`
472 470
    FOREIGN KEY (`individual_observation` )
473
    REFERENCES `default_schema`.`individual_observation` (`individual_observation` )
471
    REFERENCES `individual_observation` (`individual_observation` )
474 472
    ON DELETE NO ACTION
475 473
    ON UPDATE NO ACTION,
476 474
  CONSTRAINT `fk_stem_observation_stem1`
477 475
    FOREIGN KEY (`stem` )
478
    REFERENCES `default_schema`.`stem` (`stem` )
476
    REFERENCES `stem` (`stem` )
479 477
    ON DELETE NO ACTION
480 478
    ON UPDATE NO ACTION)
481 479
ENGINE = InnoDB
......
484 482

  
485 483

  
486 484
-- -----------------------------------------------------
487
-- Table `default_schema`.`aggregate_observation`
485
-- Table `aggregate_observation`
488 486
-- -----------------------------------------------------
489
CREATE  TABLE IF NOT EXISTS `default_schema`.`aggregate_observation` (
487
CREATE  TABLE IF NOT EXISTS `aggregate_observation` (
490 488
  `aggregate_observation` TEXT NOT NULL ,
491 489
  PRIMARY KEY (`aggregate_observation`) ,
492 490
  CONSTRAINT `fk_aggregate_observation_taxon_occurrence1`
493 491
    FOREIGN KEY (`aggregate_observation` )
494
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
492
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
495 493
    ON DELETE NO ACTION
496 494
    ON UPDATE NO ACTION)
497 495
ENGINE = InnoDB
......
500 498

  
501 499

  
502 500
-- -----------------------------------------------------
503
-- Table `default_schema`.`taxon_observation`
501
-- Table `taxon_observation`
504 502
-- -----------------------------------------------------
505
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_observation` (
503
CREATE  TABLE IF NOT EXISTS `taxon_observation` (
506 504
  `taxon_observation` TEXT NOT NULL ,
507 505
  PRIMARY KEY (`taxon_observation`) ,
508 506
  CONSTRAINT `fk_taxon_observation_taxon_occurrence1`
509 507
    FOREIGN KEY (`taxon_observation` )
510
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
508
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
511 509
    ON DELETE NO ACTION
512 510
    ON UPDATE NO ACTION)
513 511
ENGINE = InnoDB
......
516 514

  
517 515

  
518 516
-- -----------------------------------------------------
519
-- Table `default_schema`.`accepted_taxon`
517
-- Table `accepted_taxon`
520 518
-- -----------------------------------------------------
521
CREATE  TABLE IF NOT EXISTS `default_schema`.`accepted_taxon` (
519
CREATE  TABLE IF NOT EXISTS `accepted_taxon` (
522 520
  `accepted_taxon` TEXT NOT NULL ,
523 521
  PRIMARY KEY (`accepted_taxon`) ,
524 522
  CONSTRAINT `fk_accepted_taxon_taxon1`
525 523
    FOREIGN KEY (`accepted_taxon` )
526
    REFERENCES `default_schema`.`taxon` (`taxon` )
524
    REFERENCES `taxon` (`taxon` )
527 525
    ON DELETE NO ACTION
528 526
    ON UPDATE NO ACTION)
529 527
ENGINE = InnoDB
......
532 530

  
533 531

  
534 532
-- -----------------------------------------------------
535
-- Table `default_schema`.`synonym_taxon`
533
-- Table `synonym_taxon`
536 534
-- -----------------------------------------------------
537
CREATE  TABLE IF NOT EXISTS `default_schema`.`synonym_taxon` (
535
CREATE  TABLE IF NOT EXISTS `synonym_taxon` (
538 536
  `synonym_taxon` TEXT NOT NULL ,
539 537
  `accepted_taxon` TEXT NULL ,
540 538
  PRIMARY KEY (`synonym_taxon`) ,
541 539
  INDEX `fk_matched_taxon_accepted_taxon1` (`accepted_taxon` ASC) ,
542 540
  CONSTRAINT `fk_matched_taxon_taxon1`
543 541
    FOREIGN KEY (`synonym_taxon` )
544
    REFERENCES `default_schema`.`taxon` (`taxon` )
542
    REFERENCES `taxon` (`taxon` )
545 543
    ON DELETE NO ACTION
546 544
    ON UPDATE NO ACTION,
547 545
  CONSTRAINT `fk_matched_taxon_accepted_taxon1`
548 546
    FOREIGN KEY (`accepted_taxon` )
549
    REFERENCES `default_schema`.`accepted_taxon` (`accepted_taxon` )
547
    REFERENCES `accepted_taxon` (`accepted_taxon` )
550 548
    ON DELETE NO ACTION
551 549
    ON UPDATE NO ACTION)
552 550
ENGINE = InnoDB
......
555 553

  
556 554

  
557 555
-- -----------------------------------------------------
558
-- Table `default_schema`.`taxon_concept`
556
-- Table `taxon_concept`
559 557
-- -----------------------------------------------------
560
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_concept` (
558
CREATE  TABLE IF NOT EXISTS `taxon_concept` (
561 559
  `taxon_concept` TEXT NOT NULL ,
562 560
  `according_to` TEXT NOT NULL ,
563 561
  PRIMARY KEY (`taxon_concept`) ,
564 562
  INDEX `fk_taxon_concept_source1` (`according_to` ASC) ,
565 563
  CONSTRAINT `fk_taxon_concept_taxon1`
566 564
    FOREIGN KEY (`taxon_concept` )
567
    REFERENCES `default_schema`.`taxon` (`taxon` )
565
    REFERENCES `taxon` (`taxon` )
568 566
    ON DELETE NO ACTION
569 567
    ON UPDATE NO ACTION,
570 568
  CONSTRAINT `fk_taxon_concept_source1`
571 569
    FOREIGN KEY (`according_to` )
572
    REFERENCES `default_schema`.`source` (`source` )
570
    REFERENCES `source` (`source` )
573 571
    ON DELETE NO ACTION
574 572
    ON UPDATE NO ACTION)
575 573
ENGINE = InnoDB
......
578 576

  
579 577

  
580 578
-- -----------------------------------------------------
581
-- Table `default_schema`.`community`
579
-- Table `community`
582 580
-- -----------------------------------------------------
583
CREATE  TABLE IF NOT EXISTS `default_schema`.`community` (
581
CREATE  TABLE IF NOT EXISTS `community` (
584 582
  `community` TEXT NOT NULL ,
585 583
  PRIMARY KEY (`community`) ,
586 584
  CONSTRAINT `fk_community_record1`
587 585
    FOREIGN KEY (`community` )
588
    REFERENCES `default_schema`.`record` (`record` )
586
    REFERENCES `record` (`record` )
589 587
    ON DELETE CASCADE
590 588
    ON UPDATE CASCADE)
591 589
ENGINE = InnoDB
......
594 592

  
595 593

  
596 594
-- -----------------------------------------------------
597
-- Table `default_schema`.`geological_context`
595
-- Table `geological_context`
598 596
-- -----------------------------------------------------
599
CREATE  TABLE IF NOT EXISTS `default_schema`.`geological_context` (
597
CREATE  TABLE IF NOT EXISTS `geological_context` (
600 598
  `geological_context` TEXT NOT NULL ,
601 599
  PRIMARY KEY (`geological_context`) ,
602 600
  CONSTRAINT `fk_geological_context_record1`
603 601
    FOREIGN KEY (`geological_context` )
604
    REFERENCES `default_schema`.`record` (`record` )
602
    REFERENCES `record` (`record` )
605 603
    ON DELETE CASCADE
606 604
    ON UPDATE CASCADE)
607 605
ENGINE = InnoDB
......
610 608

  
611 609

  
612 610
-- -----------------------------------------------------
613
-- Table `default_schema`.`location_observation`
611
-- Table `location_observation`
614 612
-- -----------------------------------------------------
615
CREATE  TABLE IF NOT EXISTS `default_schema`.`location_observation` (
613
CREATE  TABLE IF NOT EXISTS `location_observation` (
616 614
  `location_observation` TEXT NOT NULL ,
617 615
  `location` TEXT NOT NULL ,
618 616
  `geological_context` TEXT NULL DEFAULT NULL ,
......
622 620
  INDEX `fk_location_observation_community1` (`community` ASC) ,
623 621
  CONSTRAINT `fk_location_observation_location1`
624 622
    FOREIGN KEY (`location` )
625
    REFERENCES `default_schema`.`location` (`location` )
623
    REFERENCES `location` (`location` )
626 624
    ON DELETE NO ACTION
627 625
    ON UPDATE NO ACTION,
628 626
  CONSTRAINT `fk_location_observation_geological_context1`
629 627
    FOREIGN KEY (`geological_context` )
630
    REFERENCES `default_schema`.`geological_context` (`geological_context` )
628
    REFERENCES `geological_context` (`geological_context` )
631 629
    ON DELETE NO ACTION
632 630
    ON UPDATE NO ACTION,
633 631
  CONSTRAINT `fk_location_observation_community1`
634 632
    FOREIGN KEY (`community` )
635
    REFERENCES `default_schema`.`community` (`community` )
633
    REFERENCES `community` (`community` )
636 634
    ON DELETE NO ACTION
637 635
    ON UPDATE NO ACTION,
638 636
  CONSTRAINT `fk_location_observation_event1`
639 637
    FOREIGN KEY (`location_observation` )
640
    REFERENCES `default_schema`.`event` (`event` )
638
    REFERENCES `event` (`event` )
641 639
    ON DELETE NO ACTION
642 640
    ON UPDATE NO ACTION)
643 641
ENGINE = InnoDB
......
646 644

  
647 645

  
648 646
-- -----------------------------------------------------
649
-- Table `default_schema`.`soil_observation`
647
-- Table `soil_observation`
650 648
-- -----------------------------------------------------
651
CREATE  TABLE IF NOT EXISTS `default_schema`.`soil_observation` (
649
CREATE  TABLE IF NOT EXISTS `soil_observation` (
652 650
  `soil_observation` TEXT NOT NULL ,
653 651
  PRIMARY KEY (`soil_observation`) ,
654 652
  CONSTRAINT `fk_soil_observation_location_observation1`
655 653
    FOREIGN KEY (`soil_observation` )
656
    REFERENCES `default_schema`.`location_observation` (`location_observation` )
654
    REFERENCES `location_observation` (`location_observation` )
657 655
    ON DELETE NO ACTION
658 656
    ON UPDATE NO ACTION)
659 657
ENGINE = InnoDB
......
662 660

  
663 661

  
664 662
-- -----------------------------------------------------
665
-- Table `default_schema`.`subplot`
663
-- Table `subplot`
666 664
-- -----------------------------------------------------
667
CREATE  TABLE IF NOT EXISTS `default_schema`.`subplot` (
665
CREATE  TABLE IF NOT EXISTS `subplot` (
668 666
  `subplot` TEXT NOT NULL ,
669 667
  PRIMARY KEY (`subplot`) ,
670 668
  CONSTRAINT `fk_subplot_location1`
671 669
    FOREIGN KEY (`subplot` )
672
    REFERENCES `default_schema`.`location` (`location` )
670
    REFERENCES `location` (`location` )
673 671
    ON DELETE NO ACTION
674 672
    ON UPDATE NO ACTION)
675 673
ENGINE = InnoDB
......
678 676

  
679 677

  
680 678
-- -----------------------------------------------------
681
-- Table `default_schema`.`geovalidation`
679
-- Table `geovalidation`
682 680
-- -----------------------------------------------------
683
CREATE  TABLE IF NOT EXISTS `default_schema`.`geovalidation` (
681
CREATE  TABLE IF NOT EXISTS `geovalidation` (
684 682
  `geovalidation` TEXT NOT NULL ,
685 683
  `coordinates` TEXT NOT NULL ,
686 684
  `named_place` TEXT NOT NULL ,
......
689 687
  INDEX `fk_geovalidation_placename1` (`named_place` ASC) ,
690 688
  CONSTRAINT `fk_geovalidation_record1`
691 689
    FOREIGN KEY (`geovalidation` )
692
    REFERENCES `default_schema`.`record` (`record` )
690
    REFERENCES `record` (`record` )
693 691
    ON DELETE CASCADE
694 692
    ON UPDATE CASCADE,
695 693
  CONSTRAINT `fk_geovalidation_coordinates1`
696 694
    FOREIGN KEY (`coordinates` )
697
    REFERENCES `default_schema`.`coordinates` (`coordinates` )
695
    REFERENCES `coordinates` (`coordinates` )
698 696
    ON DELETE NO ACTION
699 697
    ON UPDATE NO ACTION,
700 698
  CONSTRAINT `fk_geovalidation_placename1`
701 699
    FOREIGN KEY (`named_place` )
702
    REFERENCES `default_schema`.`named_place` (`named_place` )
700
    REFERENCES `named_place` (`named_place` )
703 701
    ON DELETE NO ACTION
704 702
    ON UPDATE NO ACTION)
705 703
ENGINE = InnoDB
......
708 706

  
709 707

  
710 708
-- -----------------------------------------------------
711
-- Table `default_schema`.`project`
709
-- Table `project`
712 710
-- -----------------------------------------------------
713
CREATE  TABLE IF NOT EXISTS `default_schema`.`project` (
711
CREATE  TABLE IF NOT EXISTS `project` (
714 712
  `project` TEXT NOT NULL ,
715 713
  PRIMARY KEY (`project`) ,
716 714
  CONSTRAINT `fk_project_event1`
717 715
    FOREIGN KEY (`project` )
718
    REFERENCES `default_schema`.`event` (`event` )
716
    REFERENCES `event` (`event` )
719 717
    ON DELETE NO ACTION
720 718
    ON UPDATE NO ACTION)
721 719
ENGINE = InnoDB
......
724 722

  
725 723

  
726 724
-- -----------------------------------------------------
727
-- Table `default_schema`.`parsed_taxon_assertion`
725
-- Table `parsed_taxon_assertion`
728 726
-- -----------------------------------------------------
729
CREATE  TABLE IF NOT EXISTS `default_schema`.`parsed_taxon_assertion` (
727
CREATE  TABLE IF NOT EXISTS `parsed_taxon_assertion` (
730 728
  `parsed_taxon_assertion` TEXT NOT NULL ,
731 729
  `matched_taxon` TEXT NULL ,
732 730
  PRIMARY KEY (`parsed_taxon_assertion`) ,
733 731
  INDEX `fk_parsed_taxon_matched_taxon1` (`matched_taxon` ASC) ,
734 732
  CONSTRAINT `fk_matched_taxon_qualified_taxon10`
735 733
    FOREIGN KEY (`parsed_taxon_assertion` )
736
    REFERENCES `default_schema`.`taxon_assertion` (`taxon_assertion` )
734
    REFERENCES `taxon_assertion` (`taxon_assertion` )
737 735
    ON DELETE NO ACTION
738 736
    ON UPDATE NO ACTION,
739 737
  CONSTRAINT `fk_parsed_taxon_matched_taxon1`
740 738
    FOREIGN KEY (`matched_taxon` )
741
    REFERENCES `default_schema`.`synonym_taxon` (`synonym_taxon` )
739
    REFERENCES `synonym_taxon` (`synonym_taxon` )
742 740
    ON DELETE NO ACTION
743 741
    ON UPDATE NO ACTION)
744 742
ENGINE = InnoDB
......
747 745

  
748 746

  
749 747
-- -----------------------------------------------------
750
-- Table `default_schema`.`verbatim_taxon_assertion`
748
-- Table `verbatim_taxon_assertion`
751 749
-- -----------------------------------------------------
752
CREATE  TABLE IF NOT EXISTS `default_schema`.`verbatim_taxon_assertion` (
750
CREATE  TABLE IF NOT EXISTS `verbatim_taxon_assertion` (
753 751
  `verbatim_taxon_assertion` TEXT NOT NULL ,
754 752
  `parsed_taxon` TEXT NULL ,
755 753
  PRIMARY KEY (`verbatim_taxon_assertion`) ,
756 754
  INDEX `fk_verbatim_taxon_parsed_taxon1` (`parsed_taxon` ASC) ,
757 755
  CONSTRAINT `fk_matched_taxon_qualified_taxon100`
758 756
    FOREIGN KEY (`verbatim_taxon_assertion` )
759
    REFERENCES `default_schema`.`taxon_assertion` (`taxon_assertion` )
757
    REFERENCES `taxon_assertion` (`taxon_assertion` )
760 758
    ON DELETE NO ACTION
761 759
    ON UPDATE NO ACTION,
762 760
  CONSTRAINT `fk_verbatim_taxon_parsed_taxon1`
763 761
    FOREIGN KEY (`parsed_taxon` )
764
    REFERENCES `default_schema`.`parsed_taxon_assertion` (`parsed_taxon_assertion` )
762
    REFERENCES `parsed_taxon_assertion` (`parsed_taxon_assertion` )
765 763
    ON DELETE NO ACTION
766 764
    ON UPDATE NO ACTION)
767 765
ENGINE = InnoDB
......
770 768

  
771 769

  
772 770
-- -----------------------------------------------------
773
-- Table `default_schema`.`party`
771
-- Table `party`
774 772
-- -----------------------------------------------------
775
CREATE  TABLE IF NOT EXISTS `default_schema`.`party` (
773
CREATE  TABLE IF NOT EXISTS `party` (
776 774
  `party` TEXT NOT NULL ,
777 775
  PRIMARY KEY (`party`) ,
778 776
  CONSTRAINT `fk_collection_source10`
779 777
    FOREIGN KEY (`party` )
780
    REFERENCES `default_schema`.`source` (`source` )
778
    REFERENCES `source` (`source` )
781 779
    ON DELETE NO ACTION
782 780
    ON UPDATE NO ACTION)
783 781
ENGINE = InnoDB
......
786 784

  
787 785

  
788 786
-- -----------------------------------------------------
789
-- Table `default_schema`.`first_publisher`
787
-- Table `first_publisher`
790 788
-- -----------------------------------------------------
791
CREATE  TABLE IF NOT EXISTS `default_schema`.`first_publisher` (
789
CREATE  TABLE IF NOT EXISTS `first_publisher` (
792 790
  `first_publisher` TEXT NOT NULL ,
793 791
  PRIMARY KEY (`first_publisher`) ,
794 792
  CONSTRAINT `fk_collection_source100`
795 793
    FOREIGN KEY (`first_publisher` )
796
    REFERENCES `default_schema`.`source` (`source` )
794
    REFERENCES `source` (`source` )
797 795
    ON DELETE NO ACTION
798 796
    ON UPDATE NO ACTION)
799 797
ENGINE = InnoDB
......
802 800

  
803 801

  
804 802
-- -----------------------------------------------------
805
-- Table `default_schema`.`referenced_class`
803
-- Table `referenced_class`
806 804
-- -----------------------------------------------------
807
CREATE  TABLE IF NOT EXISTS `default_schema`.`referenced_class` (
805
CREATE  TABLE IF NOT EXISTS `referenced_class` (
808 806
  `referenced_class` INT NOT NULL ,
809 807
  PRIMARY KEY (`referenced_class`) ,
810 808
  CONSTRAINT `fk_example_record10`
811 809
    FOREIGN KEY (`referenced_class` )
812
    REFERENCES `default_schema`.`record` (`record` )
810
    REFERENCES `record` (`record` )
813 811
    ON DELETE NO ACTION
814 812
    ON UPDATE NO ACTION)
815 813
ENGINE = InnoDB;
816 814

  
817 815

  
818 816
-- -----------------------------------------------------
819
-- Table `default_schema`.`base_class`
817
-- Table `base_class`
820 818
-- -----------------------------------------------------
821
CREATE  TABLE IF NOT EXISTS `default_schema`.`base_class` (
819
CREATE  TABLE IF NOT EXISTS `base_class` (
822 820
  `base_class` INT NOT NULL ,
823 821
  `referenced_class` INT NOT NULL ,
824 822
  PRIMARY KEY (`base_class`) ,
825 823
  INDEX `fk_base_class_referenced_class1` (`referenced_class` ASC) ,
826 824
  CONSTRAINT `fk_example_record1`
827 825
    FOREIGN KEY (`base_class` )
828
    REFERENCES `default_schema`.`record` (`record` )
826
    REFERENCES `record` (`record` )
829 827
    ON DELETE NO ACTION
830 828
    ON UPDATE NO ACTION,
831 829
  CONSTRAINT `fk_base_class_referenced_class1`
832 830
    FOREIGN KEY (`referenced_class` )
833
    REFERENCES `default_schema`.`referenced_class` (`referenced_class` )
831
    REFERENCES `referenced_class` (`referenced_class` )
834 832
    ON DELETE NO ACTION
835 833
    ON UPDATE NO ACTION)
836 834
ENGINE = InnoDB;
837 835

  
838 836

  
839 837
-- -----------------------------------------------------
840
-- Table `default_schema`.`derived_class`
838
-- Table `derived_class`
841 839
-- -----------------------------------------------------
842
CREATE  TABLE IF NOT EXISTS `default_schema`.`derived_class` (
840
CREATE  TABLE IF NOT EXISTS `derived_class` (
843 841
  `derived_class` INT NOT NULL ,
844 842
  PRIMARY KEY (`derived_class`) ,
845 843
  CONSTRAINT `fk_derived_class_base_class1`
846 844
    FOREIGN KEY (`derived_class` )
847
    REFERENCES `default_schema`.`base_class` (`base_class` )
845
    REFERENCES `base_class` (`base_class` )
848 846
    ON DELETE NO ACTION
849 847
    ON UPDATE NO ACTION)
850 848
ENGINE = InnoDB;

Also available in: Unified diff