Project

General

Profile

« Previous | Next » 

Revision 8523

schemas/VegCore/VegCore.ERD.mwb: changed globally unique column names to locally unique column names, now that the SQL dotpath algorithm (http://vegpath.org/wiki/SQL_dotpaths#Algorithm) can be used to generate globally unique column names automatically according to the fkeys. in particular, this means that the pkeys have all been renamed to "id".

View differences:

schemas/VegCore/VegCore.my.sql
7 7
-- Table `source`
8 8
-- -----------------------------------------------------
9 9
CREATE  TABLE IF NOT EXISTS `source` (
10
  `source` TEXT NOT NULL ,
11
  `source_parent` TEXT NULL DEFAULT NULL ,
12
  PRIMARY KEY (`source`) ,
13
  INDEX `fk_source1` (`source_parent` ASC) ,
10
  `id` TEXT NOT NULL ,
11
  `parent` TEXT NULL DEFAULT NULL ,
12
  PRIMARY KEY (`id`) ,
13
  INDEX `fk_source1` (`parent` ASC) ,
14 14
  CONSTRAINT `fk_source1`
15
    FOREIGN KEY (`source_parent` )
16
    REFERENCES `source` (`source` )
15
    FOREIGN KEY (`parent` )
16
    REFERENCES `source` (`id` )
17 17
    ON DELETE NO ACTION
18 18
    ON UPDATE NO ACTION)
19 19
ENGINE = InnoDB
......
25 25
-- Table `record`
26 26
-- -----------------------------------------------------
27 27
CREATE  TABLE IF NOT EXISTS `record` (
28
  `record` TEXT NOT NULL ,
28
  `id` TEXT NOT NULL ,
29 29
  `source` TEXT NOT NULL ,
30
  PRIMARY KEY (`record`) ,
30
  PRIMARY KEY (`id`) ,
31 31
  INDEX `fk_record_source1` (`source` ASC) ,
32 32
  CONSTRAINT `fk_record_source1`
33 33
    FOREIGN KEY (`source` )
34
    REFERENCES `source` (`source` )
34
    REFERENCES `source` (`id` )
35 35
    ON DELETE NO ACTION
36 36
    ON UPDATE NO ACTION)
37 37
ENGINE = InnoDB
......
43 43
-- Table `relationship`
44 44
-- -----------------------------------------------------
45 45
CREATE  TABLE IF NOT EXISTS `relationship` (
46
  `relationship` TEXT NOT NULL ,
46
  `id` TEXT NOT NULL ,
47 47
  `record` TEXT NOT NULL ,
48 48
  `related_record` TEXT NOT NULL ,
49
  PRIMARY KEY (`relationship`) ,
49
  PRIMARY KEY (`id`) ,
50 50
  INDEX `fk_relationship_record1` (`record` ASC) ,
51 51
  INDEX `fk_relationship_related_record` (`related_record` ASC) ,
52 52
  CONSTRAINT `fk_relationship_record1`
53
    FOREIGN KEY (`relationship` )
54
    REFERENCES `record` (`record` )
53
    FOREIGN KEY (`id` )
54
    REFERENCES `record` (`id` )
55 55
    ON DELETE CASCADE
56 56
    ON UPDATE CASCADE,
57 57
  CONSTRAINT `fk_relationship_record1`
58 58
    FOREIGN KEY (`record` )
59
    REFERENCES `record` (`record` )
59
    REFERENCES `record` (`id` )
60 60
    ON DELETE NO ACTION
61 61
    ON UPDATE NO ACTION,
62 62
  CONSTRAINT `fk_relationship_related_record`
63 63
    FOREIGN KEY (`related_record` )
64
    REFERENCES `record` (`record` )
64
    REFERENCES `record` (`id` )
65 65
    ON DELETE NO ACTION
66 66
    ON UPDATE NO ACTION)
67 67
ENGINE = InnoDB
......
73 73
-- Table `taxon`
74 74
-- -----------------------------------------------------
75 75
CREATE  TABLE IF NOT EXISTS `taxon` (
76
  `taxon` TEXT NOT NULL ,
77
  `taxon_parent` TEXT NULL ,
78
  PRIMARY KEY (`taxon`) ,
79
  INDEX `fk_taxon_taxon1` (`taxon_parent` ASC) ,
76
  `id` TEXT NOT NULL ,
77
  `parent` TEXT NULL DEFAULT NULL ,
78
  PRIMARY KEY (`id`) ,
79
  INDEX `fk_taxon_taxon1` (`parent` ASC) ,
80 80
  CONSTRAINT `fk_taxon_record1`
81
    FOREIGN KEY (`taxon` )
82
    REFERENCES `record` (`record` )
81
    FOREIGN KEY (`id` )
82
    REFERENCES `record` (`id` )
83 83
    ON DELETE CASCADE
84 84
    ON UPDATE CASCADE,
85 85
  CONSTRAINT `fk_taxon_taxon1`
86
    FOREIGN KEY (`taxon_parent` )
87
    REFERENCES `taxon` (`taxon` )
86
    FOREIGN KEY (`parent` )
87
    REFERENCES `taxon` (`id` )
88 88
    ON DELETE NO ACTION
89 89
    ON UPDATE NO ACTION)
90 90
ENGINE = InnoDB
......
96 96
-- Table `taxon_assertion`
97 97
-- -----------------------------------------------------
98 98
CREATE  TABLE IF NOT EXISTS `taxon_assertion` (
99
  `taxon_assertion` TEXT NOT NULL ,
99
  `id` TEXT NOT NULL ,
100 100
  `taxon` TEXT NOT NULL ,
101
  PRIMARY KEY (`taxon_assertion`) ,
101
  PRIMARY KEY (`id`) ,
102 102
  INDEX `fk_qualified_taxon_name_taxon1` (`taxon` ASC) ,
103 103
  CONSTRAINT `fk_qualified_taxon_record1`
104
    FOREIGN KEY (`taxon_assertion` )
105
    REFERENCES `record` (`record` )
104
    FOREIGN KEY (`id` )
105
    REFERENCES `record` (`id` )
106 106
    ON DELETE CASCADE
107 107
    ON UPDATE CASCADE,
108 108
  CONSTRAINT `fk_qualified_taxon_name_taxon1`
109 109
    FOREIGN KEY (`taxon` )
110
    REFERENCES `taxon` (`taxon` )
110
    REFERENCES `taxon` (`id` )
111 111
    ON DELETE NO ACTION
112 112
    ON UPDATE NO ACTION)
113 113
ENGINE = InnoDB
......
119 119
-- Table `taxon_determination`
120 120
-- -----------------------------------------------------
121 121
CREATE  TABLE IF NOT EXISTS `taxon_determination` (
122
  `taxon_determination` VARCHAR(45) NOT NULL ,
122
  `id` TEXT NOT NULL ,
123 123
  `taxon_occurrence` TEXT NOT NULL ,
124 124
  `qualified_taxon` TEXT NOT NULL ,
125 125
  INDEX `fk_taxon_occurrence_has_qualified_taxon1` (`qualified_taxon` ASC) ,
126 126
  INDEX `fk_taxon_occurrence_has_qualified_taxon_occurrence1` (`taxon_occurrence` ASC) ,
127
  PRIMARY KEY (`taxon_determination`) ,
127
  PRIMARY KEY (`id`) ,
128 128
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon_occurrence1`
129 129
    FOREIGN KEY (`taxon_occurrence` )
130
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
130
    REFERENCES `taxon_occurrence` (`id` )
131 131
    ON DELETE NO ACTION
132 132
    ON UPDATE NO ACTION,
133 133
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon1`
134 134
    FOREIGN KEY (`qualified_taxon` )
135
    REFERENCES `taxon_assertion` (`taxon_assertion` )
135
    REFERENCES `taxon_assertion` (`id` )
136 136
    ON DELETE NO ACTION
137 137
    ON UPDATE NO ACTION,
138 138
  CONSTRAINT `fk_taxon_determination_record1`
139
    FOREIGN KEY (`taxon_determination` )
140
    REFERENCES `record` (`record` )
139
    FOREIGN KEY (`id` )
140
    REFERENCES `record` (`id` )
141 141
    ON DELETE NO ACTION
142 142
    ON UPDATE NO ACTION)
143 143
ENGINE = InnoDB
......
149 149
-- Table `coordinates`
150 150
-- -----------------------------------------------------
151 151
CREATE  TABLE IF NOT EXISTS `coordinates` (
152
  `coordinates` TEXT NOT NULL ,
153
  PRIMARY KEY (`coordinates`) ,
152
  `id` TEXT NOT NULL ,
153
  PRIMARY KEY (`id`) ,
154 154
  CONSTRAINT `fk_coordinates_record1`
155
    FOREIGN KEY (`coordinates` )
156
    REFERENCES `record` (`record` )
155
    FOREIGN KEY (`id` )
156
    REFERENCES `record` (`id` )
157 157
    ON DELETE CASCADE
158 158
    ON UPDATE CASCADE)
159 159
ENGINE = InnoDB
......
165 165
-- Table `named_place`
166 166
-- -----------------------------------------------------
167 167
CREATE  TABLE IF NOT EXISTS `named_place` (
168
  `named_place` TEXT NOT NULL ,
169
  PRIMARY KEY (`named_place`) ,
168
  `id` TEXT NOT NULL ,
169
  PRIMARY KEY (`id`) ,
170 170
  CONSTRAINT `fk_named_place_record1`
171
    FOREIGN KEY (`named_place` )
172
    REFERENCES `record` (`record` )
171
    FOREIGN KEY (`id` )
172
    REFERENCES `record` (`id` )
173 173
    ON DELETE CASCADE
174 174
    ON UPDATE CASCADE)
175 175
ENGINE = InnoDB
......
181 181
-- Table `location`
182 182
-- -----------------------------------------------------
183 183
CREATE  TABLE IF NOT EXISTS `location` (
184
  `location` TEXT NOT NULL ,
185
  `location_parent` TEXT NULL DEFAULT NULL ,
184
  `id` TEXT NOT NULL ,
185
  `parent` TEXT NULL DEFAULT NULL ,
186 186
  `named_place` TEXT NULL DEFAULT NULL ,
187 187
  `coordinates` TEXT NULL DEFAULT NULL ,
188
  PRIMARY KEY (`location`) ,
188
  PRIMARY KEY (`id`) ,
189 189
  INDEX `fk_location_coordinates1` (`coordinates` ASC) ,
190 190
  INDEX `fk_location_placename1` (`named_place` ASC) ,
191
  INDEX `fk_location1` (`location_parent` ASC) ,
191
  INDEX `fk_location1` (`parent` ASC) ,
192 192
  CONSTRAINT `fk_location_record1`
193
    FOREIGN KEY (`location` )
194
    REFERENCES `record` (`record` )
193
    FOREIGN KEY (`id` )
194
    REFERENCES `record` (`id` )
195 195
    ON DELETE CASCADE
196 196
    ON UPDATE CASCADE,
197 197
  CONSTRAINT `fk_location_coordinates1`
198 198
    FOREIGN KEY (`coordinates` )
199
    REFERENCES `coordinates` (`coordinates` )
199
    REFERENCES `coordinates` (`id` )
200 200
    ON DELETE NO ACTION
201 201
    ON UPDATE NO ACTION,
202 202
  CONSTRAINT `fk_location_placename1`
203 203
    FOREIGN KEY (`named_place` )
204
    REFERENCES `named_place` (`named_place` )
204
    REFERENCES `named_place` (`id` )
205 205
    ON DELETE NO ACTION
206 206
    ON UPDATE NO ACTION,
207 207
  CONSTRAINT `fk_location1`
208
    FOREIGN KEY (`location_parent` )
209
    REFERENCES `location` (`location` )
208
    FOREIGN KEY (`parent` )
209
    REFERENCES `location` (`id` )
210 210
    ON DELETE NO ACTION
211 211
    ON UPDATE NO ACTION)
212 212
ENGINE = InnoDB
......
218 218
-- Table `method`
219 219
-- -----------------------------------------------------
220 220
CREATE  TABLE IF NOT EXISTS `method` (
221
  `method` TEXT NOT NULL ,
222
  PRIMARY KEY (`method`) ,
221
  `id` TEXT NOT NULL ,
222
  PRIMARY KEY (`id`) ,
223 223
  CONSTRAINT `fk_method_record1`
224
    FOREIGN KEY (`method` )
225
    REFERENCES `record` (`record` )
224
    FOREIGN KEY (`id` )
225
    REFERENCES `record` (`id` )
226 226
    ON DELETE CASCADE
227 227
    ON UPDATE CASCADE)
228 228
ENGINE = InnoDB
......
234 234
-- Table `event`
235 235
-- -----------------------------------------------------
236 236
CREATE  TABLE IF NOT EXISTS `event` (
237
  `event` TEXT NOT NULL ,
238
  `event_parent` TEXT NULL DEFAULT NULL ,
237
  `id` TEXT NOT NULL ,
238
  `parent` TEXT NULL DEFAULT NULL ,
239 239
  `location` TEXT NULL DEFAULT NULL ,
240 240
  `method` TEXT NULL DEFAULT NULL ,
241
  PRIMARY KEY (`event`) ,
241
  PRIMARY KEY (`id`) ,
242 242
  INDEX `fk_event_location1` (`location` ASC) ,
243
  INDEX `fk_event1` (`event_parent` ASC) ,
243
  INDEX `fk_event1` (`parent` ASC) ,
244 244
  INDEX `fk_event_method1` (`method` ASC) ,
245 245
  CONSTRAINT `fk_event_record1`
246
    FOREIGN KEY (`event` )
247
    REFERENCES `record` (`record` )
246
    FOREIGN KEY (`id` )
247
    REFERENCES `record` (`id` )
248 248
    ON DELETE CASCADE
249 249
    ON UPDATE CASCADE,
250 250
  CONSTRAINT `fk_event_location1`
251 251
    FOREIGN KEY (`location` )
252
    REFERENCES `location` (`location` )
252
    REFERENCES `location` (`id` )
253 253
    ON DELETE NO ACTION
254 254
    ON UPDATE NO ACTION,
255 255
  CONSTRAINT `fk_event1`
256
    FOREIGN KEY (`event_parent` )
257
    REFERENCES `event` (`event` )
256
    FOREIGN KEY (`parent` )
257
    REFERENCES `event` (`id` )
258 258
    ON DELETE NO ACTION
259 259
    ON UPDATE NO ACTION,
260 260
  CONSTRAINT `fk_event_method1`
261 261
    FOREIGN KEY (`method` )
262
    REFERENCES `method` (`method` )
262
    REFERENCES `method` (`id` )
263 263
    ON DELETE NO ACTION
264 264
    ON UPDATE NO ACTION)
265 265
ENGINE = InnoDB
......
271 271
-- Table `taxon_occurrence`
272 272
-- -----------------------------------------------------
273 273
CREATE  TABLE IF NOT EXISTS `taxon_occurrence` (
274
  `taxon_occurrence` TEXT NOT NULL ,
275
  `current_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
276
  `original_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
274
  `id` TEXT NOT NULL ,
275
  `current_taxon_determination` TEXT NULL DEFAULT NULL ,
276
  `original_taxon_determination` TEXT NULL DEFAULT NULL ,
277
  PRIMARY KEY (`id`) ,
277 278
  INDEX `fk_taxon_occurrence_taxon_determination1` (`original_taxon_determination` ASC) ,
278 279
  INDEX `fk_taxon_occurrence_taxon_determination2` (`current_taxon_determination` ASC) ,
279
  INDEX `fk_taxon_occurrence_event1` (`taxon_occurrence` ASC) ,
280 280
  CONSTRAINT `fk_taxon_occurrence_taxon_determination1`
281 281
    FOREIGN KEY (`original_taxon_determination` )
282
    REFERENCES `taxon_determination` (`taxon_determination` )
282
    REFERENCES `taxon_determination` (`id` )
283 283
    ON DELETE NO ACTION
284 284
    ON UPDATE NO ACTION,
285 285
  CONSTRAINT `fk_taxon_occurrence_taxon_determination2`
286 286
    FOREIGN KEY (`current_taxon_determination` )
287
    REFERENCES `taxon_determination` (`taxon_determination` )
287
    REFERENCES `taxon_determination` (`id` )
288 288
    ON DELETE NO ACTION
289 289
    ON UPDATE NO ACTION,
290 290
  CONSTRAINT `fk_taxon_occurrence_event1`
291
    FOREIGN KEY (`taxon_occurrence` )
292
    REFERENCES `event` (`event` )
291
    FOREIGN KEY (`id` )
292
    REFERENCES `event` (`id` )
293 293
    ON DELETE NO ACTION
294 294
    ON UPDATE NO ACTION)
295 295
ENGINE = InnoDB
......
301 301
-- Table `trait`
302 302
-- -----------------------------------------------------
303 303
CREATE  TABLE IF NOT EXISTS `trait` (
304
  `trait` TEXT NOT NULL ,
304
  `id` TEXT NOT NULL ,
305 305
  `taxon_occurrence` TEXT NOT NULL ,
306
  PRIMARY KEY (`trait`) ,
306
  PRIMARY KEY (`id`) ,
307 307
  INDEX `fk_trait_taxon_occurrence1` (`taxon_occurrence` ASC) ,
308 308
  CONSTRAINT `fk_measurement_record1`
309
    FOREIGN KEY (`trait` )
310
    REFERENCES `record` (`record` )
309
    FOREIGN KEY (`id` )
310
    REFERENCES `record` (`id` )
311 311
    ON DELETE CASCADE
312 312
    ON UPDATE CASCADE,
313 313
  CONSTRAINT `fk_trait_taxon_occurrence1`
314 314
    FOREIGN KEY (`taxon_occurrence` )
315
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
315
    REFERENCES `taxon_occurrence` (`id` )
316 316
    ON DELETE NO ACTION
317 317
    ON UPDATE NO ACTION)
318 318
ENGINE = InnoDB
......
324 324
-- Table `collection`
325 325
-- -----------------------------------------------------
326 326
CREATE  TABLE IF NOT EXISTS `collection` (
327
  `collection` TEXT NOT NULL ,
328
  PRIMARY KEY (`collection`) ,
327
  `id` TEXT NOT NULL ,
328
  PRIMARY KEY (`id`) ,
329 329
  CONSTRAINT `fk_collection_source1`
330
    FOREIGN KEY (`collection` )
331
    REFERENCES `source` (`source` )
330
    FOREIGN KEY (`id` )
331
    REFERENCES `source` (`id` )
332 332
    ON DELETE NO ACTION
333 333
    ON UPDATE NO ACTION)
334 334
ENGINE = InnoDB
......
340 340
-- Table `specimen`
341 341
-- -----------------------------------------------------
342 342
CREATE  TABLE IF NOT EXISTS `specimen` (
343
  `specimen` TEXT NOT NULL ,
343
  `id` TEXT NOT NULL ,
344 344
  `collection` TEXT NOT NULL ,
345
  PRIMARY KEY (`specimen`) ,
345
  PRIMARY KEY (`id`) ,
346 346
  INDEX `fk_specimen_collection1` (`collection` ASC) ,
347 347
  CONSTRAINT `fk_specimen_taxon_occurrence1`
348
    FOREIGN KEY (`specimen` )
349
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
348
    FOREIGN KEY (`id` )
349
    REFERENCES `taxon_occurrence` (`id` )
350 350
    ON DELETE NO ACTION
351 351
    ON UPDATE NO ACTION,
352 352
  CONSTRAINT `fk_specimen_collection1`
353 353
    FOREIGN KEY (`collection` )
354
    REFERENCES `collection` (`collection` )
354
    REFERENCES `collection` (`id` )
355 355
    ON DELETE NO ACTION
356 356
    ON UPDATE NO ACTION)
357 357
ENGINE = InnoDB
......
363 363
-- Table `voucher`
364 364
-- -----------------------------------------------------
365 365
CREATE  TABLE IF NOT EXISTS `voucher` (
366
  `voucher` TEXT NOT NULL ,
366
  `id` TEXT NOT NULL ,
367 367
  `taxon_occurrence` TEXT NOT NULL ,
368 368
  `specimen` TEXT NOT NULL ,
369
  PRIMARY KEY (`voucher`) ,
369
  PRIMARY KEY (`id`) ,
370 370
  INDEX `fk_voucher_taxon_occurrence1` (`taxon_occurrence` ASC) ,
371 371
  INDEX `fk_voucher_specimen1` (`specimen` ASC) ,
372 372
  CONSTRAINT `fk_voucher_record1`
373
    FOREIGN KEY (`voucher` )
374
    REFERENCES `record` (`record` )
373
    FOREIGN KEY (`id` )
374
    REFERENCES `record` (`id` )
375 375
    ON DELETE CASCADE
376 376
    ON UPDATE CASCADE,
377 377
  CONSTRAINT `fk_voucher_taxon_occurrence1`
378 378
    FOREIGN KEY (`taxon_occurrence` )
379
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
379
    REFERENCES `taxon_occurrence` (`id` )
380 380
    ON DELETE NO ACTION
381 381
    ON UPDATE NO ACTION,
382 382
  CONSTRAINT `fk_voucher_specimen1`
383 383
    FOREIGN KEY (`specimen` )
384
    REFERENCES `specimen` (`specimen` )
384
    REFERENCES `specimen` (`id` )
385 385
    ON DELETE NO ACTION
386 386
    ON UPDATE NO ACTION)
387 387
ENGINE = InnoDB
......
393 393
-- Table `individual`
394 394
-- -----------------------------------------------------
395 395
CREATE  TABLE IF NOT EXISTS `individual` (
396
  `individual` TEXT NOT NULL ,
397
  PRIMARY KEY (`individual`) ,
396
  `id` TEXT NOT NULL ,
397
  PRIMARY KEY (`id`) ,
398 398
  CONSTRAINT `fk_individual_record1`
399
    FOREIGN KEY (`individual` )
400
    REFERENCES `record` (`record` )
399
    FOREIGN KEY (`id` )
400
    REFERENCES `record` (`id` )
401 401
    ON DELETE CASCADE
402 402
    ON UPDATE CASCADE)
403 403
ENGINE = InnoDB
......
409 409
-- Table `individual_observation`
410 410
-- -----------------------------------------------------
411 411
CREATE  TABLE IF NOT EXISTS `individual_observation` (
412
  `individual_observation` TEXT NOT NULL ,
412
  `id` TEXT NOT NULL ,
413 413
  `individual` TEXT NOT NULL ,
414
  PRIMARY KEY (`individual_observation`) ,
414
  PRIMARY KEY (`id`) ,
415 415
  INDEX `fk_individual_observation_individual1` (`individual` ASC) ,
416 416
  CONSTRAINT `fk_individual_observation_taxon_occurrence1`
417
    FOREIGN KEY (`individual_observation` )
418
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
417
    FOREIGN KEY (`id` )
418
    REFERENCES `taxon_occurrence` (`id` )
419 419
    ON DELETE NO ACTION
420 420
    ON UPDATE NO ACTION,
421 421
  CONSTRAINT `fk_individual_observation_individual1`
422 422
    FOREIGN KEY (`individual` )
423
    REFERENCES `individual` (`individual` )
423
    REFERENCES `individual` (`id` )
424 424
    ON DELETE NO ACTION
425 425
    ON UPDATE NO ACTION)
426 426
ENGINE = InnoDB
......
432 432
-- Table `stem`
433 433
-- -----------------------------------------------------
434 434
CREATE  TABLE IF NOT EXISTS `stem` (
435
  `stem` TEXT NOT NULL ,
435
  `id` TEXT NOT NULL ,
436 436
  `individual` TEXT NOT NULL ,
437
  PRIMARY KEY (`stem`) ,
437
  PRIMARY KEY (`id`) ,
438 438
  INDEX `fk_stem_individual1` (`individual` ASC) ,
439 439
  CONSTRAINT `fk_stem_record1`
440
    FOREIGN KEY (`stem` )
441
    REFERENCES `record` (`record` )
440
    FOREIGN KEY (`id` )
441
    REFERENCES `record` (`id` )
442 442
    ON DELETE CASCADE
443 443
    ON UPDATE CASCADE,
444 444
  CONSTRAINT `fk_stem_individual1`
445 445
    FOREIGN KEY (`individual` )
446
    REFERENCES `individual` (`individual` )
446
    REFERENCES `individual` (`id` )
447 447
    ON DELETE NO ACTION
448 448
    ON UPDATE NO ACTION)
449 449
ENGINE = InnoDB
......
455 455
-- Table `stem_observation`
456 456
-- -----------------------------------------------------
457 457
CREATE  TABLE IF NOT EXISTS `stem_observation` (
458
  `stem_observation` TEXT NOT NULL ,
458
  `id` TEXT NOT NULL ,
459 459
  `individual_observation` TEXT NOT NULL ,
460 460
  `stem` TEXT NOT NULL ,
461
  PRIMARY KEY (`stem_observation`) ,
461
  PRIMARY KEY (`id`) ,
462 462
  INDEX `fk_stem_observation_individual_observation1` (`individual_observation` ASC) ,
463 463
  INDEX `fk_stem_observation_stem1` (`stem` ASC) ,
464 464
  CONSTRAINT `fk_stem_observation_record1`
465
    FOREIGN KEY (`stem_observation` )
466
    REFERENCES `record` (`record` )
465
    FOREIGN KEY (`id` )
466
    REFERENCES `record` (`id` )
467 467
    ON DELETE CASCADE
468 468
    ON UPDATE CASCADE,
469 469
  CONSTRAINT `fk_stem_observation_individual_observation1`
470 470
    FOREIGN KEY (`individual_observation` )
471
    REFERENCES `individual_observation` (`individual_observation` )
471
    REFERENCES `individual_observation` (`id` )
472 472
    ON DELETE NO ACTION
473 473
    ON UPDATE NO ACTION,
474 474
  CONSTRAINT `fk_stem_observation_stem1`
475 475
    FOREIGN KEY (`stem` )
476
    REFERENCES `stem` (`stem` )
476
    REFERENCES `stem` (`id` )
477 477
    ON DELETE NO ACTION
478 478
    ON UPDATE NO ACTION)
479 479
ENGINE = InnoDB
......
485 485
-- Table `aggregate_observation`
486 486
-- -----------------------------------------------------
487 487
CREATE  TABLE IF NOT EXISTS `aggregate_observation` (
488
  `aggregate_observation` TEXT NOT NULL ,
489
  PRIMARY KEY (`aggregate_observation`) ,
488
  `id` TEXT NOT NULL ,
489
  PRIMARY KEY (`id`) ,
490 490
  CONSTRAINT `fk_aggregate_observation_taxon_occurrence1`
491
    FOREIGN KEY (`aggregate_observation` )
492
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
491
    FOREIGN KEY (`id` )
492
    REFERENCES `taxon_occurrence` (`id` )
493 493
    ON DELETE NO ACTION
494 494
    ON UPDATE NO ACTION)
495 495
ENGINE = InnoDB
......
501 501
-- Table `taxon_observation`
502 502
-- -----------------------------------------------------
503 503
CREATE  TABLE IF NOT EXISTS `taxon_observation` (
504
  `taxon_observation` TEXT NOT NULL ,
505
  PRIMARY KEY (`taxon_observation`) ,
504
  `id` TEXT NOT NULL ,
505
  PRIMARY KEY (`id`) ,
506 506
  CONSTRAINT `fk_taxon_observation_taxon_occurrence1`
507
    FOREIGN KEY (`taxon_observation` )
508
    REFERENCES `taxon_occurrence` (`taxon_occurrence` )
507
    FOREIGN KEY (`id` )
508
    REFERENCES `taxon_occurrence` (`id` )
509 509
    ON DELETE NO ACTION
510 510
    ON UPDATE NO ACTION)
511 511
ENGINE = InnoDB
......
517 517
-- Table `accepted_taxon`
518 518
-- -----------------------------------------------------
519 519
CREATE  TABLE IF NOT EXISTS `accepted_taxon` (
520
  `accepted_taxon` TEXT NOT NULL ,
521
  PRIMARY KEY (`accepted_taxon`) ,
520
  `id` TEXT NOT NULL ,
521
  PRIMARY KEY (`id`) ,
522 522
  CONSTRAINT `fk_accepted_taxon_taxon1`
523
    FOREIGN KEY (`accepted_taxon` )
524
    REFERENCES `taxon` (`taxon` )
523
    FOREIGN KEY (`id` )
524
    REFERENCES `taxon` (`id` )
525 525
    ON DELETE NO ACTION
526 526
    ON UPDATE NO ACTION)
527 527
ENGINE = InnoDB
......
533 533
-- Table `synonym_taxon`
534 534
-- -----------------------------------------------------
535 535
CREATE  TABLE IF NOT EXISTS `synonym_taxon` (
536
  `synonym_taxon` TEXT NOT NULL ,
536
  `id` TEXT NOT NULL ,
537 537
  `accepted_taxon` TEXT NULL ,
538
  PRIMARY KEY (`synonym_taxon`) ,
538
  PRIMARY KEY (`id`) ,
539 539
  INDEX `fk_matched_taxon_accepted_taxon1` (`accepted_taxon` ASC) ,
540 540
  CONSTRAINT `fk_matched_taxon_taxon1`
541
    FOREIGN KEY (`synonym_taxon` )
542
    REFERENCES `taxon` (`taxon` )
541
    FOREIGN KEY (`id` )
542
    REFERENCES `taxon` (`id` )
543 543
    ON DELETE NO ACTION
544 544
    ON UPDATE NO ACTION,
545 545
  CONSTRAINT `fk_matched_taxon_accepted_taxon1`
546 546
    FOREIGN KEY (`accepted_taxon` )
547
    REFERENCES `accepted_taxon` (`accepted_taxon` )
547
    REFERENCES `accepted_taxon` (`id` )
548 548
    ON DELETE NO ACTION
549 549
    ON UPDATE NO ACTION)
550 550
ENGINE = InnoDB
......
556 556
-- Table `taxon_concept`
557 557
-- -----------------------------------------------------
558 558
CREATE  TABLE IF NOT EXISTS `taxon_concept` (
559
  `taxon_concept` TEXT NOT NULL ,
559
  `id` TEXT NOT NULL ,
560 560
  `according_to` TEXT NOT NULL ,
561
  PRIMARY KEY (`taxon_concept`) ,
561
  PRIMARY KEY (`id`) ,
562 562
  INDEX `fk_taxon_concept_source1` (`according_to` ASC) ,
563 563
  CONSTRAINT `fk_taxon_concept_taxon1`
564
    FOREIGN KEY (`taxon_concept` )
565
    REFERENCES `taxon` (`taxon` )
564
    FOREIGN KEY (`id` )
565
    REFERENCES `taxon` (`id` )
566 566
    ON DELETE NO ACTION
567 567
    ON UPDATE NO ACTION,
568 568
  CONSTRAINT `fk_taxon_concept_source1`
569 569
    FOREIGN KEY (`according_to` )
570
    REFERENCES `source` (`source` )
570
    REFERENCES `source` (`id` )
571 571
    ON DELETE NO ACTION
572 572
    ON UPDATE NO ACTION)
573 573
ENGINE = InnoDB
......
579 579
-- Table `community`
580 580
-- -----------------------------------------------------
581 581
CREATE  TABLE IF NOT EXISTS `community` (
582
  `community` TEXT NOT NULL ,
583
  PRIMARY KEY (`community`) ,
582
  `id` TEXT NOT NULL ,
583
  PRIMARY KEY (`id`) ,
584 584
  CONSTRAINT `fk_community_record1`
585
    FOREIGN KEY (`community` )
586
    REFERENCES `record` (`record` )
585
    FOREIGN KEY (`id` )
586
    REFERENCES `record` (`id` )
587 587
    ON DELETE CASCADE
588 588
    ON UPDATE CASCADE)
589 589
ENGINE = InnoDB
......
595 595
-- Table `geological_context`
596 596
-- -----------------------------------------------------
597 597
CREATE  TABLE IF NOT EXISTS `geological_context` (
598
  `geological_context` TEXT NOT NULL ,
599
  PRIMARY KEY (`geological_context`) ,
598
  `id` TEXT NOT NULL ,
599
  PRIMARY KEY (`id`) ,
600 600
  CONSTRAINT `fk_geological_context_record1`
601
    FOREIGN KEY (`geological_context` )
602
    REFERENCES `record` (`record` )
601
    FOREIGN KEY (`id` )
602
    REFERENCES `record` (`id` )
603 603
    ON DELETE CASCADE
604 604
    ON UPDATE CASCADE)
605 605
ENGINE = InnoDB
......
611 611
-- Table `location_observation`
612 612
-- -----------------------------------------------------
613 613
CREATE  TABLE IF NOT EXISTS `location_observation` (
614
  `location_observation` TEXT NOT NULL ,
614
  `id` TEXT NOT NULL ,
615 615
  `location` TEXT NOT NULL ,
616 616
  `geological_context` TEXT NULL DEFAULT NULL ,
617 617
  `community` TEXT NULL DEFAULT NULL ,
618 618
  INDEX `fk_location_observation_location1` (`location` ASC) ,
619 619
  INDEX `fk_location_observation_geological_context1` (`geological_context` ASC) ,
620 620
  INDEX `fk_location_observation_community1` (`community` ASC) ,
621
  INDEX `fk_location_observation_event1` (`id` ASC) ,
622
  PRIMARY KEY (`id`) ,
621 623
  CONSTRAINT `fk_location_observation_location1`
622 624
    FOREIGN KEY (`location` )
623
    REFERENCES `location` (`location` )
625
    REFERENCES `location` (`id` )
624 626
    ON DELETE NO ACTION
625 627
    ON UPDATE NO ACTION,
626 628
  CONSTRAINT `fk_location_observation_geological_context1`
627 629
    FOREIGN KEY (`geological_context` )
628
    REFERENCES `geological_context` (`geological_context` )
630
    REFERENCES `geological_context` (`id` )
629 631
    ON DELETE NO ACTION
630 632
    ON UPDATE NO ACTION,
631 633
  CONSTRAINT `fk_location_observation_community1`
632 634
    FOREIGN KEY (`community` )
633
    REFERENCES `community` (`community` )
635
    REFERENCES `community` (`id` )
634 636
    ON DELETE NO ACTION
635 637
    ON UPDATE NO ACTION,
636 638
  CONSTRAINT `fk_location_observation_event1`
637
    FOREIGN KEY (`location_observation` )
638
    REFERENCES `event` (`event` )
639
    FOREIGN KEY (`id` )
640
    REFERENCES `event` (`id` )
639 641
    ON DELETE NO ACTION
640 642
    ON UPDATE NO ACTION)
641 643
ENGINE = InnoDB
......
647 649
-- Table `soil_observation`
648 650
-- -----------------------------------------------------
649 651
CREATE  TABLE IF NOT EXISTS `soil_observation` (
650
  `soil_observation` TEXT NOT NULL ,
651
  PRIMARY KEY (`soil_observation`) ,
652
  `id` TEXT NOT NULL ,
653
  PRIMARY KEY (`id`) ,
652 654
  CONSTRAINT `fk_soil_observation_location_observation1`
653
    FOREIGN KEY (`soil_observation` )
654
    REFERENCES `location_observation` (`location_observation` )
655
    FOREIGN KEY (`id` )
656
    REFERENCES `location_observation` (`id` )
655 657
    ON DELETE NO ACTION
656 658
    ON UPDATE NO ACTION)
657 659
ENGINE = InnoDB
......
663 665
-- Table `subplot`
664 666
-- -----------------------------------------------------
665 667
CREATE  TABLE IF NOT EXISTS `subplot` (
666
  `subplot` TEXT NOT NULL ,
667
  PRIMARY KEY (`subplot`) ,
668
  `id` TEXT NOT NULL ,
669
  PRIMARY KEY (`id`) ,
668 670
  CONSTRAINT `fk_subplot_location1`
669
    FOREIGN KEY (`subplot` )
670
    REFERENCES `location` (`location` )
671
    FOREIGN KEY (`id` )
672
    REFERENCES `location` (`id` )
671 673
    ON DELETE NO ACTION
672 674
    ON UPDATE NO ACTION)
673 675
ENGINE = InnoDB
......
679 681
-- Table `geovalidation`
680 682
-- -----------------------------------------------------
681 683
CREATE  TABLE IF NOT EXISTS `geovalidation` (
682
  `geovalidation` TEXT NOT NULL ,
684
  `id` TEXT NOT NULL ,
683 685
  `coordinates` TEXT NOT NULL ,
684 686
  `named_place` TEXT NOT NULL ,
685
  PRIMARY KEY (`geovalidation`) ,
687
  PRIMARY KEY (`id`) ,
686 688
  INDEX `fk_geovalidation_coordinates1` (`coordinates` ASC) ,
687 689
  INDEX `fk_geovalidation_placename1` (`named_place` ASC) ,
688 690
  CONSTRAINT `fk_geovalidation_record1`
689
    FOREIGN KEY (`geovalidation` )
690
    REFERENCES `record` (`record` )
691
    FOREIGN KEY (`id` )
692
    REFERENCES `record` (`id` )
691 693
    ON DELETE CASCADE
692 694
    ON UPDATE CASCADE,
693 695
  CONSTRAINT `fk_geovalidation_coordinates1`
694 696
    FOREIGN KEY (`coordinates` )
695
    REFERENCES `coordinates` (`coordinates` )
697
    REFERENCES `coordinates` (`id` )
696 698
    ON DELETE NO ACTION
697 699
    ON UPDATE NO ACTION,
698 700
  CONSTRAINT `fk_geovalidation_placename1`
699 701
    FOREIGN KEY (`named_place` )
700
    REFERENCES `named_place` (`named_place` )
702
    REFERENCES `named_place` (`id` )
701 703
    ON DELETE NO ACTION
702 704
    ON UPDATE NO ACTION)
703 705
ENGINE = InnoDB
......
709 711
-- Table `project`
710 712
-- -----------------------------------------------------
711 713
CREATE  TABLE IF NOT EXISTS `project` (
712
  `project` TEXT NOT NULL ,
713
  PRIMARY KEY (`project`) ,
714
  `id` TEXT NOT NULL ,
715
  PRIMARY KEY (`id`) ,
714 716
  CONSTRAINT `fk_project_event1`
715
    FOREIGN KEY (`project` )
716
    REFERENCES `event` (`event` )
717
    FOREIGN KEY (`id` )
718
    REFERENCES `event` (`id` )
717 719
    ON DELETE NO ACTION
718 720
    ON UPDATE NO ACTION)
719 721
ENGINE = InnoDB
......
725 727
-- Table `parsed_taxon_assertion`
726 728
-- -----------------------------------------------------
727 729
CREATE  TABLE IF NOT EXISTS `parsed_taxon_assertion` (
728
  `parsed_taxon_assertion` TEXT NOT NULL ,
730
  `id` TEXT NOT NULL ,
729 731
  `matched_taxon` TEXT NULL ,
730
  PRIMARY KEY (`parsed_taxon_assertion`) ,
732
  PRIMARY KEY (`id`) ,
731 733
  INDEX `fk_parsed_taxon_matched_taxon1` (`matched_taxon` ASC) ,
732 734
  CONSTRAINT `fk_matched_taxon_qualified_taxon10`
733
    FOREIGN KEY (`parsed_taxon_assertion` )
734
    REFERENCES `taxon_assertion` (`taxon_assertion` )
735
    FOREIGN KEY (`id` )
736
    REFERENCES `taxon_assertion` (`id` )
735 737
    ON DELETE NO ACTION
736 738
    ON UPDATE NO ACTION,
737 739
  CONSTRAINT `fk_parsed_taxon_matched_taxon1`
738 740
    FOREIGN KEY (`matched_taxon` )
739
    REFERENCES `synonym_taxon` (`synonym_taxon` )
741
    REFERENCES `synonym_taxon` (`id` )
740 742
    ON DELETE NO ACTION
741 743
    ON UPDATE NO ACTION)
742 744
ENGINE = InnoDB
......
748 750
-- Table `verbatim_taxon_assertion`
749 751
-- -----------------------------------------------------
750 752
CREATE  TABLE IF NOT EXISTS `verbatim_taxon_assertion` (
751
  `verbatim_taxon_assertion` TEXT NOT NULL ,
753
  `id` TEXT NOT NULL ,
752 754
  `parsed_taxon` TEXT NULL ,
753
  PRIMARY KEY (`verbatim_taxon_assertion`) ,
755
  PRIMARY KEY (`id`) ,
754 756
  INDEX `fk_verbatim_taxon_parsed_taxon1` (`parsed_taxon` ASC) ,
755 757
  CONSTRAINT `fk_matched_taxon_qualified_taxon100`
756
    FOREIGN KEY (`verbatim_taxon_assertion` )
757
    REFERENCES `taxon_assertion` (`taxon_assertion` )
758
    FOREIGN KEY (`id` )
759
    REFERENCES `taxon_assertion` (`id` )
758 760
    ON DELETE NO ACTION
759 761
    ON UPDATE NO ACTION,
760 762
  CONSTRAINT `fk_verbatim_taxon_parsed_taxon1`
761 763
    FOREIGN KEY (`parsed_taxon` )
762
    REFERENCES `parsed_taxon_assertion` (`parsed_taxon_assertion` )
764
    REFERENCES `parsed_taxon_assertion` (`id` )
763 765
    ON DELETE NO ACTION
764 766
    ON UPDATE NO ACTION)
765 767
ENGINE = InnoDB
......
771 773
-- Table `party`
772 774
-- -----------------------------------------------------
773 775
CREATE  TABLE IF NOT EXISTS `party` (
774
  `party` TEXT NOT NULL ,
775
  PRIMARY KEY (`party`) ,
776
  `id` TEXT NOT NULL ,
777
  PRIMARY KEY (`id`) ,
776 778
  CONSTRAINT `fk_collection_source10`
777
    FOREIGN KEY (`party` )
778
    REFERENCES `source` (`source` )
779
    FOREIGN KEY (`id` )
780
    REFERENCES `source` (`id` )
779 781
    ON DELETE NO ACTION
780 782
    ON UPDATE NO ACTION)
781 783
ENGINE = InnoDB
......
787 789
-- Table `first_publisher`
788 790
-- -----------------------------------------------------
789 791
CREATE  TABLE IF NOT EXISTS `first_publisher` (
790
  `first_publisher` TEXT NOT NULL ,
791
  PRIMARY KEY (`first_publisher`) ,
792
  `id` TEXT NOT NULL ,
793
  PRIMARY KEY (`id`) ,
792 794
  CONSTRAINT `fk_collection_source100`
793
    FOREIGN KEY (`first_publisher` )
794
    REFERENCES `source` (`source` )
795
    FOREIGN KEY (`id` )
796
    REFERENCES `source` (`id` )
795 797
    ON DELETE NO ACTION
796 798
    ON UPDATE NO ACTION)
797 799
ENGINE = InnoDB
......
803 805
-- Table `referenced_class`
804 806
-- -----------------------------------------------------
805 807
CREATE  TABLE IF NOT EXISTS `referenced_class` (
806
  `referenced_class` INT NOT NULL ,
807
  PRIMARY KEY (`referenced_class`) ,
808
  `id` TEXT NOT NULL ,
809
  PRIMARY KEY (`id`) ,
808 810
  CONSTRAINT `fk_example_record10`
809
    FOREIGN KEY (`referenced_class` )
810
    REFERENCES `record` (`record` )
811
    FOREIGN KEY (`id` )
812
    REFERENCES `record` (`id` )
811 813
    ON DELETE NO ACTION
812 814
    ON UPDATE NO ACTION)
813
ENGINE = InnoDB;
815
ENGINE = InnoDB
816
DEFAULT CHARACTER SET = latin1
817
COLLATE = latin1_swedish_ci;
814 818

  
815 819

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

  
836 842

  
837 843
-- -----------------------------------------------------
838 844
-- Table `derived_class`
839 845
-- -----------------------------------------------------
840 846
CREATE  TABLE IF NOT EXISTS `derived_class` (
841
  `derived_class` INT NOT NULL ,
842
  PRIMARY KEY (`derived_class`) ,
847
  `id` TEXT NOT NULL ,
848
  PRIMARY KEY (`id`) ,
843 849
  CONSTRAINT `fk_derived_class_base_class1`
844
    FOREIGN KEY (`derived_class` )
845
    REFERENCES `base_class` (`base_class` )
850
    FOREIGN KEY (`id` )
851
    REFERENCES `base_class` (`id` )
846 852
    ON DELETE NO ACTION
847 853
    ON UPDATE NO ACTION)
848
ENGINE = InnoDB;
854
ENGINE = InnoDB
855
DEFAULT CHARACTER SET = latin1
856
COLLATE = latin1_swedish_ci;
849 857

  
850 858

  
851 859

  

Also available in: Unified diff