Project

General

Profile

« Previous | Next » 

Revision 8336

Added schemas/VegCore/VegCore.ERD.mwb, VegCore.my.sql with first VegCore ERD and MySQL schema. All tables are in the ERD, but contain only pkey and fkey columns.

View differences:

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

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

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

  
25

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

  
43

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

  
73

  
74
-- -----------------------------------------------------
75
-- Table `default_schema`.`coordinates`
76
-- -----------------------------------------------------
77
CREATE  TABLE IF NOT EXISTS `default_schema`.`coordinates` (
78
  `coordinates` TEXT NOT NULL ,
79
  PRIMARY KEY (`coordinates`) ,
80
  CONSTRAINT `fk_coordinates_record1`
81
    FOREIGN KEY (`coordinates` )
82
    REFERENCES `default_schema`.`record` (`record` )
83
    ON DELETE CASCADE
84
    ON UPDATE CASCADE)
85
ENGINE = InnoDB
86
DEFAULT CHARACTER SET = latin1
87
COLLATE = latin1_swedish_ci;
88

  
89

  
90
-- -----------------------------------------------------
91
-- Table `default_schema`.`named_place`
92
-- -----------------------------------------------------
93
CREATE  TABLE IF NOT EXISTS `default_schema`.`named_place` (
94
  `named_place` TEXT NOT NULL ,
95
  PRIMARY KEY (`named_place`) ,
96
  CONSTRAINT `fk_named_place_record1`
97
    FOREIGN KEY (`named_place` )
98
    REFERENCES `default_schema`.`record` (`record` )
99
    ON DELETE CASCADE
100
    ON UPDATE CASCADE)
101
ENGINE = InnoDB
102
DEFAULT CHARACTER SET = latin1
103
COLLATE = latin1_swedish_ci;
104

  
105

  
106
-- -----------------------------------------------------
107
-- Table `default_schema`.`location`
108
-- -----------------------------------------------------
109
CREATE  TABLE IF NOT EXISTS `default_schema`.`location` (
110
  `location` TEXT NOT NULL ,
111
  `location_parent` TEXT NULL DEFAULT NULL ,
112
  `placename` TEXT NULL DEFAULT NULL ,
113
  `coordinates` TEXT NULL DEFAULT NULL ,
114
  PRIMARY KEY (`location`) ,
115
  INDEX `fk_location_coordinates1` (`coordinates` ASC) ,
116
  INDEX `fk_location_placename1` (`placename` ASC) ,
117
  INDEX `fk_location1` (`location_parent` ASC) ,
118
  CONSTRAINT `fk_location_record1`
119
    FOREIGN KEY (`location` )
120
    REFERENCES `default_schema`.`record` (`record` )
121
    ON DELETE CASCADE
122
    ON UPDATE CASCADE,
123
  CONSTRAINT `fk_location_coordinates1`
124
    FOREIGN KEY (`coordinates` )
125
    REFERENCES `default_schema`.`coordinates` (`coordinates` )
126
    ON DELETE NO ACTION
127
    ON UPDATE NO ACTION,
128
  CONSTRAINT `fk_location_placename1`
129
    FOREIGN KEY (`placename` )
130
    REFERENCES `default_schema`.`named_place` (`named_place` )
131
    ON DELETE NO ACTION
132
    ON UPDATE NO ACTION,
133
  CONSTRAINT `fk_location1`
134
    FOREIGN KEY (`location_parent` )
135
    REFERENCES `default_schema`.`location` (`location` )
136
    ON DELETE NO ACTION
137
    ON UPDATE NO ACTION)
138
ENGINE = InnoDB
139
DEFAULT CHARACTER SET = latin1
140
COLLATE = latin1_swedish_ci;
141

  
142

  
143
-- -----------------------------------------------------
144
-- Table `default_schema`.`method`
145
-- -----------------------------------------------------
146
CREATE  TABLE IF NOT EXISTS `default_schema`.`method` (
147
  `method` TEXT NOT NULL ,
148
  PRIMARY KEY (`method`) ,
149
  CONSTRAINT `fk_method_record1`
150
    FOREIGN KEY (`method` )
151
    REFERENCES `default_schema`.`record` (`record` )
152
    ON DELETE CASCADE
153
    ON UPDATE CASCADE)
154
ENGINE = InnoDB
155
DEFAULT CHARACTER SET = latin1
156
COLLATE = latin1_swedish_ci;
157

  
158

  
159
-- -----------------------------------------------------
160
-- Table `default_schema`.`event`
161
-- -----------------------------------------------------
162
CREATE  TABLE IF NOT EXISTS `default_schema`.`event` (
163
  `event` TEXT NOT NULL ,
164
  `event_parent` TEXT NULL DEFAULT NULL ,
165
  `location` TEXT NULL DEFAULT NULL ,
166
  `method` TEXT NULL DEFAULT NULL ,
167
  PRIMARY KEY (`event`) ,
168
  INDEX `fk_event_location1` (`location` ASC) ,
169
  INDEX `fk_event1` (`event_parent` ASC) ,
170
  INDEX `fk_event_method1` (`method` ASC) ,
171
  CONSTRAINT `fk_event_record1`
172
    FOREIGN KEY (`event` )
173
    REFERENCES `default_schema`.`record` (`record` )
174
    ON DELETE CASCADE
175
    ON UPDATE CASCADE,
176
  CONSTRAINT `fk_event_location1`
177
    FOREIGN KEY (`location` )
178
    REFERENCES `default_schema`.`location` (`location` )
179
    ON DELETE NO ACTION
180
    ON UPDATE NO ACTION,
181
  CONSTRAINT `fk_event1`
182
    FOREIGN KEY (`event_parent` )
183
    REFERENCES `default_schema`.`event` (`event` )
184
    ON DELETE NO ACTION
185
    ON UPDATE NO ACTION,
186
  CONSTRAINT `fk_event_method1`
187
    FOREIGN KEY (`method` )
188
    REFERENCES `default_schema`.`method` (`method` )
189
    ON DELETE NO ACTION
190
    ON UPDATE NO ACTION)
191
ENGINE = InnoDB
192
DEFAULT CHARACTER SET = latin1
193
COLLATE = latin1_swedish_ci;
194

  
195

  
196
-- -----------------------------------------------------
197
-- Table `default_schema`.`occurrence`
198
-- -----------------------------------------------------
199
CREATE  TABLE IF NOT EXISTS `default_schema`.`occurrence` (
200
  `occurrence` TEXT NOT NULL ,
201
  PRIMARY KEY (`occurrence`) ,
202
  INDEX `fk_occurrence_record1` (`occurrence` ASC) ,
203
  CONSTRAINT `fk_occurrence_event1`
204
    FOREIGN KEY (`occurrence` )
205
    REFERENCES `default_schema`.`event` (`event` )
206
    ON DELETE NO ACTION
207
    ON UPDATE NO ACTION)
208
ENGINE = InnoDB
209
DEFAULT CHARACTER SET = latin1
210
COLLATE = latin1_swedish_ci;
211

  
212

  
213
-- -----------------------------------------------------
214
-- Table `default_schema`.`measurement`
215
-- -----------------------------------------------------
216
CREATE  TABLE IF NOT EXISTS `default_schema`.`measurement` (
217
  `measurement` TEXT NOT NULL ,
218
  `occurrence` TEXT NOT NULL ,
219
  PRIMARY KEY (`measurement`) ,
220
  INDEX `fk_measurement_occurrence1` (`occurrence` ASC) ,
221
  CONSTRAINT `fk_measurement_record1`
222
    FOREIGN KEY (`measurement` )
223
    REFERENCES `default_schema`.`record` (`record` )
224
    ON DELETE CASCADE
225
    ON UPDATE CASCADE,
226
  CONSTRAINT `fk_measurement_occurrence1`
227
    FOREIGN KEY (`occurrence` )
228
    REFERENCES `default_schema`.`occurrence` (`occurrence` )
229
    ON DELETE NO ACTION
230
    ON UPDATE NO ACTION)
231
ENGINE = InnoDB
232
DEFAULT CHARACTER SET = latin1
233
COLLATE = latin1_swedish_ci;
234

  
235

  
236
-- -----------------------------------------------------
237
-- Table `default_schema`.`taxon`
238
-- -----------------------------------------------------
239
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon` (
240
  `taxon` TEXT NOT NULL ,
241
  PRIMARY KEY (`taxon`) ,
242
  CONSTRAINT `fk_taxon_record1`
243
    FOREIGN KEY (`taxon` )
244
    REFERENCES `default_schema`.`record` (`record` )
245
    ON DELETE CASCADE
246
    ON UPDATE CASCADE)
247
ENGINE = InnoDB
248
DEFAULT CHARACTER SET = latin1
249
COLLATE = latin1_swedish_ci;
250

  
251

  
252
-- -----------------------------------------------------
253
-- Table `default_schema`.`qualified_taxon`
254
-- -----------------------------------------------------
255
CREATE  TABLE IF NOT EXISTS `default_schema`.`qualified_taxon` (
256
  `qualified_taxon` TEXT NOT NULL ,
257
  `taxon` TEXT NOT NULL ,
258
  PRIMARY KEY (`qualified_taxon`) ,
259
  INDEX `fk_qualified_taxon_name_taxon1` (`taxon` ASC) ,
260
  CONSTRAINT `fk_qualified_taxon_record1`
261
    FOREIGN KEY (`qualified_taxon` )
262
    REFERENCES `default_schema`.`record` (`record` )
263
    ON DELETE CASCADE
264
    ON UPDATE CASCADE,
265
  CONSTRAINT `fk_qualified_taxon_name_taxon1`
266
    FOREIGN KEY (`taxon` )
267
    REFERENCES `default_schema`.`taxon` (`taxon` )
268
    ON DELETE NO ACTION
269
    ON UPDATE NO ACTION)
270
ENGINE = InnoDB
271
DEFAULT CHARACTER SET = latin1
272
COLLATE = latin1_swedish_ci;
273

  
274

  
275
-- -----------------------------------------------------
276
-- Table `default_schema`.`taxon_determination`
277
-- -----------------------------------------------------
278
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_determination` (
279
  `taxon_determination` VARCHAR(45) NOT NULL ,
280
  `taxon_occurrence` TEXT NOT NULL ,
281
  `qualified_taxon` TEXT NOT NULL ,
282
  INDEX `fk_taxon_occurrence_has_qualified_taxon1` (`qualified_taxon` ASC) ,
283
  INDEX `fk_taxon_occurrence_has_qualified_taxon_occurrence1` (`taxon_occurrence` ASC) ,
284
  PRIMARY KEY (`taxon_determination`) ,
285
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon_occurrence1`
286
    FOREIGN KEY (`taxon_occurrence` )
287
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
288
    ON DELETE NO ACTION
289
    ON UPDATE NO ACTION,
290
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon1`
291
    FOREIGN KEY (`qualified_taxon` )
292
    REFERENCES `default_schema`.`qualified_taxon` (`qualified_taxon` )
293
    ON DELETE NO ACTION
294
    ON UPDATE NO ACTION,
295
  CONSTRAINT `fk_taxon_determination_record1`
296
    FOREIGN KEY (`taxon_determination` )
297
    REFERENCES `default_schema`.`record` (`record` )
298
    ON DELETE NO ACTION
299
    ON UPDATE NO ACTION)
300
ENGINE = InnoDB
301
DEFAULT CHARACTER SET = latin1
302
COLLATE = latin1_swedish_ci;
303

  
304

  
305
-- -----------------------------------------------------
306
-- Table `default_schema`.`taxon_occurrence`
307
-- -----------------------------------------------------
308
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_occurrence` (
309
  `taxon_occurrence` TEXT NOT NULL ,
310
  `current_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
311
  `original_taxon_determination` VARCHAR(45) NULL DEFAULT NULL ,
312
  PRIMARY KEY (`taxon_occurrence`) ,
313
  INDEX `fk_taxon_occurrence_taxon_determination1` (`original_taxon_determination` ASC) ,
314
  INDEX `fk_taxon_occurrence_taxon_determination2` (`current_taxon_determination` ASC) ,
315
  CONSTRAINT `fk_taxon_occurrence1`
316
    FOREIGN KEY (`taxon_occurrence` )
317
    REFERENCES `default_schema`.`occurrence` (`occurrence` )
318
    ON DELETE NO ACTION
319
    ON UPDATE NO ACTION,
320
  CONSTRAINT `fk_taxon_occurrence_taxon_determination1`
321
    FOREIGN KEY (`original_taxon_determination` )
322
    REFERENCES `default_schema`.`taxon_determination` (`taxon_determination` )
323
    ON DELETE NO ACTION
324
    ON UPDATE NO ACTION,
325
  CONSTRAINT `fk_taxon_occurrence_taxon_determination2`
326
    FOREIGN KEY (`current_taxon_determination` )
327
    REFERENCES `default_schema`.`taxon_determination` (`taxon_determination` )
328
    ON DELETE NO ACTION
329
    ON UPDATE NO ACTION)
330
ENGINE = InnoDB
331
DEFAULT CHARACTER SET = latin1
332
COLLATE = latin1_swedish_ci;
333

  
334

  
335
-- -----------------------------------------------------
336
-- Table `default_schema`.`collection`
337
-- -----------------------------------------------------
338
CREATE  TABLE IF NOT EXISTS `default_schema`.`collection` (
339
  `collection` TEXT NOT NULL ,
340
  PRIMARY KEY (`collection`) ,
341
  CONSTRAINT `fk_collection_source1`
342
    FOREIGN KEY (`collection` )
343
    REFERENCES `default_schema`.`source` (`source` )
344
    ON DELETE NO ACTION
345
    ON UPDATE NO ACTION)
346
ENGINE = InnoDB
347
DEFAULT CHARACTER SET = latin1
348
COLLATE = latin1_swedish_ci;
349

  
350

  
351
-- -----------------------------------------------------
352
-- Table `default_schema`.`specimen`
353
-- -----------------------------------------------------
354
CREATE  TABLE IF NOT EXISTS `default_schema`.`specimen` (
355
  `specimen` TEXT NOT NULL ,
356
  `collection` TEXT NOT NULL ,
357
  PRIMARY KEY (`specimen`) ,
358
  INDEX `fk_specimen_collection1` (`collection` ASC) ,
359
  CONSTRAINT `fk_specimen_taxon_occurrence1`
360
    FOREIGN KEY (`specimen` )
361
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
362
    ON DELETE NO ACTION
363
    ON UPDATE NO ACTION,
364
  CONSTRAINT `fk_specimen_collection1`
365
    FOREIGN KEY (`collection` )
366
    REFERENCES `default_schema`.`collection` (`collection` )
367
    ON DELETE NO ACTION
368
    ON UPDATE NO ACTION)
369
ENGINE = InnoDB
370
DEFAULT CHARACTER SET = latin1
371
COLLATE = latin1_swedish_ci;
372

  
373

  
374
-- -----------------------------------------------------
375
-- Table `default_schema`.`voucher`
376
-- -----------------------------------------------------
377
CREATE  TABLE IF NOT EXISTS `default_schema`.`voucher` (
378
  `voucher` TEXT NOT NULL ,
379
  `taxon_occurrence` TEXT NOT NULL ,
380
  `specimen` TEXT NOT NULL ,
381
  PRIMARY KEY (`voucher`) ,
382
  INDEX `fk_voucher_taxon_occurrence1` (`taxon_occurrence` ASC) ,
383
  INDEX `fk_voucher_specimen1` (`specimen` ASC) ,
384
  CONSTRAINT `fk_voucher_record1`
385
    FOREIGN KEY (`voucher` )
386
    REFERENCES `default_schema`.`record` (`record` )
387
    ON DELETE CASCADE
388
    ON UPDATE CASCADE,
389
  CONSTRAINT `fk_voucher_taxon_occurrence1`
390
    FOREIGN KEY (`taxon_occurrence` )
391
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
392
    ON DELETE NO ACTION
393
    ON UPDATE NO ACTION,
394
  CONSTRAINT `fk_voucher_specimen1`
395
    FOREIGN KEY (`specimen` )
396
    REFERENCES `default_schema`.`specimen` (`specimen` )
397
    ON DELETE NO ACTION
398
    ON UPDATE NO ACTION)
399
ENGINE = InnoDB
400
DEFAULT CHARACTER SET = latin1
401
COLLATE = latin1_swedish_ci;
402

  
403

  
404
-- -----------------------------------------------------
405
-- Table `default_schema`.`individual`
406
-- -----------------------------------------------------
407
CREATE  TABLE IF NOT EXISTS `default_schema`.`individual` (
408
  `individual` TEXT NOT NULL ,
409
  PRIMARY KEY (`individual`) ,
410
  CONSTRAINT `fk_individual_record1`
411
    FOREIGN KEY (`individual` )
412
    REFERENCES `default_schema`.`record` (`record` )
413
    ON DELETE CASCADE
414
    ON UPDATE CASCADE)
415
ENGINE = InnoDB
416
DEFAULT CHARACTER SET = latin1
417
COLLATE = latin1_swedish_ci;
418

  
419

  
420
-- -----------------------------------------------------
421
-- Table `default_schema`.`individual_observation`
422
-- -----------------------------------------------------
423
CREATE  TABLE IF NOT EXISTS `default_schema`.`individual_observation` (
424
  `individual_observation` TEXT NOT NULL ,
425
  `individual` TEXT NOT NULL ,
426
  PRIMARY KEY (`individual_observation`) ,
427
  INDEX `fk_individual_observation_individual1` (`individual` ASC) ,
428
  CONSTRAINT `fk_individual_observation_taxon_occurrence1`
429
    FOREIGN KEY (`individual_observation` )
430
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
431
    ON DELETE NO ACTION
432
    ON UPDATE NO ACTION,
433
  CONSTRAINT `fk_individual_observation_individual1`
434
    FOREIGN KEY (`individual` )
435
    REFERENCES `default_schema`.`individual` (`individual` )
436
    ON DELETE NO ACTION
437
    ON UPDATE NO ACTION)
438
ENGINE = InnoDB
439
DEFAULT CHARACTER SET = latin1
440
COLLATE = latin1_swedish_ci;
441

  
442

  
443
-- -----------------------------------------------------
444
-- Table `default_schema`.`stem`
445
-- -----------------------------------------------------
446
CREATE  TABLE IF NOT EXISTS `default_schema`.`stem` (
447
  `stem` TEXT NOT NULL ,
448
  `individual` TEXT NOT NULL ,
449
  PRIMARY KEY (`stem`) ,
450
  INDEX `fk_stem_individual1` (`individual` ASC) ,
451
  CONSTRAINT `fk_stem_record1`
452
    FOREIGN KEY (`stem` )
453
    REFERENCES `default_schema`.`record` (`record` )
454
    ON DELETE CASCADE
455
    ON UPDATE CASCADE,
456
  CONSTRAINT `fk_stem_individual1`
457
    FOREIGN KEY (`individual` )
458
    REFERENCES `default_schema`.`individual` (`individual` )
459
    ON DELETE NO ACTION
460
    ON UPDATE NO ACTION)
461
ENGINE = InnoDB
462
DEFAULT CHARACTER SET = latin1
463
COLLATE = latin1_swedish_ci;
464

  
465

  
466
-- -----------------------------------------------------
467
-- Table `default_schema`.`stem_observation`
468
-- -----------------------------------------------------
469
CREATE  TABLE IF NOT EXISTS `default_schema`.`stem_observation` (
470
  `stem_observation` TEXT NOT NULL ,
471
  `individual_observation` TEXT NOT NULL ,
472
  `stem` TEXT NOT NULL ,
473
  PRIMARY KEY (`stem_observation`) ,
474
  INDEX `fk_stem_observation_individual_observation1` (`individual_observation` ASC) ,
475
  INDEX `fk_stem_observation_stem1` (`stem` ASC) ,
476
  CONSTRAINT `fk_stem_observation_record1`
477
    FOREIGN KEY (`stem_observation` )
478
    REFERENCES `default_schema`.`record` (`record` )
479
    ON DELETE CASCADE
480
    ON UPDATE CASCADE,
481
  CONSTRAINT `fk_stem_observation_individual_observation1`
482
    FOREIGN KEY (`individual_observation` )
483
    REFERENCES `default_schema`.`individual_observation` (`individual_observation` )
484
    ON DELETE NO ACTION
485
    ON UPDATE NO ACTION,
486
  CONSTRAINT `fk_stem_observation_stem1`
487
    FOREIGN KEY (`stem` )
488
    REFERENCES `default_schema`.`stem` (`stem` )
489
    ON DELETE NO ACTION
490
    ON UPDATE NO ACTION)
491
ENGINE = InnoDB
492
DEFAULT CHARACTER SET = latin1
493
COLLATE = latin1_swedish_ci;
494

  
495

  
496
-- -----------------------------------------------------
497
-- Table `default_schema`.`aggregate_observation`
498
-- -----------------------------------------------------
499
CREATE  TABLE IF NOT EXISTS `default_schema`.`aggregate_observation` (
500
  `aggregate_observation` TEXT NOT NULL ,
501
  PRIMARY KEY (`aggregate_observation`) ,
502
  CONSTRAINT `fk_aggregate_observation_taxon_occurrence1`
503
    FOREIGN KEY (`aggregate_observation` )
504
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
505
    ON DELETE NO ACTION
506
    ON UPDATE NO ACTION)
507
ENGINE = InnoDB
508
DEFAULT CHARACTER SET = latin1
509
COLLATE = latin1_swedish_ci;
510

  
511

  
512
-- -----------------------------------------------------
513
-- Table `default_schema`.`taxon_observation`
514
-- -----------------------------------------------------
515
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_observation` (
516
  `taxon_observation` TEXT NOT NULL ,
517
  PRIMARY KEY (`taxon_observation`) ,
518
  CONSTRAINT `fk_taxon_observation_taxon_occurrence1`
519
    FOREIGN KEY (`taxon_observation` )
520
    REFERENCES `default_schema`.`taxon_occurrence` (`taxon_occurrence` )
521
    ON DELETE NO ACTION
522
    ON UPDATE NO ACTION)
523
ENGINE = InnoDB
524
DEFAULT CHARACTER SET = latin1
525
COLLATE = latin1_swedish_ci;
526

  
527

  
528
-- -----------------------------------------------------
529
-- Table `default_schema`.`verbatim_taxon`
530
-- -----------------------------------------------------
531
CREATE  TABLE IF NOT EXISTS `default_schema`.`verbatim_taxon` (
532
  `verbatim_taxon` TEXT NOT NULL ,
533
  PRIMARY KEY (`verbatim_taxon`) ,
534
  CONSTRAINT `fk_matched_taxon_qualified_taxon100`
535
    FOREIGN KEY (`verbatim_taxon` )
536
    REFERENCES `default_schema`.`qualified_taxon` (`qualified_taxon` )
537
    ON DELETE NO ACTION
538
    ON UPDATE NO ACTION)
539
ENGINE = InnoDB
540
DEFAULT CHARACTER SET = latin1
541
COLLATE = latin1_swedish_ci;
542

  
543

  
544
-- -----------------------------------------------------
545
-- Table `default_schema`.`parsed_taxon`
546
-- -----------------------------------------------------
547
CREATE  TABLE IF NOT EXISTS `default_schema`.`parsed_taxon` (
548
  `parsed_taxon` TEXT NOT NULL ,
549
  `verbatim_taxon` TEXT NOT NULL ,
550
  PRIMARY KEY (`parsed_taxon`) ,
551
  INDEX `fk_parsed_taxon_verbatim_taxon1` (`verbatim_taxon` ASC) ,
552
  CONSTRAINT `fk_matched_taxon_qualified_taxon10`
553
    FOREIGN KEY (`parsed_taxon` )
554
    REFERENCES `default_schema`.`qualified_taxon` (`qualified_taxon` )
555
    ON DELETE NO ACTION
556
    ON UPDATE NO ACTION,
557
  CONSTRAINT `fk_parsed_taxon_verbatim_taxon1`
558
    FOREIGN KEY (`verbatim_taxon` )
559
    REFERENCES `default_schema`.`verbatim_taxon` (`verbatim_taxon` )
560
    ON DELETE NO ACTION
561
    ON UPDATE NO ACTION)
562
ENGINE = InnoDB
563
DEFAULT CHARACTER SET = latin1
564
COLLATE = latin1_swedish_ci;
565

  
566

  
567
-- -----------------------------------------------------
568
-- Table `default_schema`.`matched_taxon`
569
-- -----------------------------------------------------
570
CREATE  TABLE IF NOT EXISTS `default_schema`.`matched_taxon` (
571
  `matched_taxon` TEXT NOT NULL ,
572
  `parsed_taxon` TEXT NOT NULL ,
573
  PRIMARY KEY (`matched_taxon`) ,
574
  INDEX `fk_matched_taxon_parsed_taxon1` (`parsed_taxon` ASC) ,
575
  CONSTRAINT `fk_matched_taxon_qualified_taxon1`
576
    FOREIGN KEY (`matched_taxon` )
577
    REFERENCES `default_schema`.`qualified_taxon` (`qualified_taxon` )
578
    ON DELETE NO ACTION
579
    ON UPDATE NO ACTION,
580
  CONSTRAINT `fk_matched_taxon_parsed_taxon1`
581
    FOREIGN KEY (`parsed_taxon` )
582
    REFERENCES `default_schema`.`parsed_taxon` (`parsed_taxon` )
583
    ON DELETE NO ACTION
584
    ON UPDATE NO ACTION)
585
ENGINE = InnoDB
586
DEFAULT CHARACTER SET = latin1
587
COLLATE = latin1_swedish_ci;
588

  
589

  
590
-- -----------------------------------------------------
591
-- Table `default_schema`.`accepted_taxon`
592
-- -----------------------------------------------------
593
CREATE  TABLE IF NOT EXISTS `default_schema`.`accepted_taxon` (
594
  `accepted_taxon` TEXT NOT NULL ,
595
  `matched_taxon` TEXT NOT NULL ,
596
  PRIMARY KEY (`accepted_taxon`) ,
597
  INDEX `fk_accepted_taxon_matched_taxon1` (`matched_taxon` ASC) ,
598
  CONSTRAINT `fk_accepted_taxon_qualified_taxon1`
599
    FOREIGN KEY (`accepted_taxon` )
600
    REFERENCES `default_schema`.`qualified_taxon` (`qualified_taxon` )
601
    ON DELETE NO ACTION
602
    ON UPDATE NO ACTION,
603
  CONSTRAINT `fk_accepted_taxon_matched_taxon1`
604
    FOREIGN KEY (`matched_taxon` )
605
    REFERENCES `default_schema`.`matched_taxon` (`matched_taxon` )
606
    ON DELETE NO ACTION
607
    ON UPDATE NO ACTION)
608
ENGINE = InnoDB
609
DEFAULT CHARACTER SET = latin1
610
COLLATE = latin1_swedish_ci;
611

  
612

  
613
-- -----------------------------------------------------
614
-- Table `default_schema`.`taxon_concept`
615
-- -----------------------------------------------------
616
CREATE  TABLE IF NOT EXISTS `default_schema`.`taxon_concept` (
617
  `taxon_concept` TEXT NOT NULL ,
618
  `source` TEXT NOT NULL ,
619
  PRIMARY KEY (`taxon_concept`) ,
620
  INDEX `fk_taxon_concept_source1` (`source` ASC) ,
621
  CONSTRAINT `fk_taxon_concept_taxon1`
622
    FOREIGN KEY (`taxon_concept` )
623
    REFERENCES `default_schema`.`taxon` (`taxon` )
624
    ON DELETE NO ACTION
625
    ON UPDATE NO ACTION,
626
  CONSTRAINT `fk_taxon_concept_source1`
627
    FOREIGN KEY (`source` )
628
    REFERENCES `default_schema`.`source` (`source` )
629
    ON DELETE NO ACTION
630
    ON UPDATE NO ACTION)
631
ENGINE = InnoDB
632
DEFAULT CHARACTER SET = latin1
633
COLLATE = latin1_swedish_ci;
634

  
635

  
636
-- -----------------------------------------------------
637
-- Table `default_schema`.`community`
638
-- -----------------------------------------------------
639
CREATE  TABLE IF NOT EXISTS `default_schema`.`community` (
640
  `community` TEXT NOT NULL ,
641
  PRIMARY KEY (`community`) ,
642
  CONSTRAINT `fk_community_record1`
643
    FOREIGN KEY (`community` )
644
    REFERENCES `default_schema`.`record` (`record` )
645
    ON DELETE CASCADE
646
    ON UPDATE CASCADE)
647
ENGINE = InnoDB
648
DEFAULT CHARACTER SET = latin1
649
COLLATE = latin1_swedish_ci;
650

  
651

  
652
-- -----------------------------------------------------
653
-- Table `default_schema`.`geological_context`
654
-- -----------------------------------------------------
655
CREATE  TABLE IF NOT EXISTS `default_schema`.`geological_context` (
656
  `geological_context` TEXT NOT NULL ,
657
  PRIMARY KEY (`geological_context`) ,
658
  CONSTRAINT `fk_geological_context_record1`
659
    FOREIGN KEY (`geological_context` )
660
    REFERENCES `default_schema`.`record` (`record` )
661
    ON DELETE CASCADE
662
    ON UPDATE CASCADE)
663
ENGINE = InnoDB
664
DEFAULT CHARACTER SET = latin1
665
COLLATE = latin1_swedish_ci;
666

  
667

  
668
-- -----------------------------------------------------
669
-- Table `default_schema`.`location_observation`
670
-- -----------------------------------------------------
671
CREATE  TABLE IF NOT EXISTS `default_schema`.`location_observation` (
672
  `location_observation` TEXT NOT NULL ,
673
  `location` TEXT NOT NULL ,
674
  `geological_context` TEXT NULL DEFAULT NULL ,
675
  `community` TEXT NULL DEFAULT NULL ,
676
  PRIMARY KEY (`location_observation`) ,
677
  INDEX `fk_location_observation_location1` (`location` ASC) ,
678
  INDEX `fk_location_observation_geological_context1` (`geological_context` ASC) ,
679
  INDEX `fk_location_observation_community1` (`community` ASC) ,
680
  CONSTRAINT `fk_location_observation_location1`
681
    FOREIGN KEY (`location` )
682
    REFERENCES `default_schema`.`location` (`location` )
683
    ON DELETE NO ACTION
684
    ON UPDATE NO ACTION,
685
  CONSTRAINT `fk_location_observation_occurrence1`
686
    FOREIGN KEY (`location_observation` )
687
    REFERENCES `default_schema`.`occurrence` (`occurrence` )
688
    ON DELETE NO ACTION
689
    ON UPDATE NO ACTION,
690
  CONSTRAINT `fk_location_observation_geological_context1`
691
    FOREIGN KEY (`geological_context` )
692
    REFERENCES `default_schema`.`geological_context` (`geological_context` )
693
    ON DELETE NO ACTION
694
    ON UPDATE NO ACTION,
695
  CONSTRAINT `fk_location_observation_community1`
696
    FOREIGN KEY (`community` )
697
    REFERENCES `default_schema`.`community` (`community` )
698
    ON DELETE NO ACTION
699
    ON UPDATE NO ACTION)
700
ENGINE = InnoDB
701
DEFAULT CHARACTER SET = latin1
702
COLLATE = latin1_swedish_ci;
703

  
704

  
705
-- -----------------------------------------------------
706
-- Table `default_schema`.`soil_observation`
707
-- -----------------------------------------------------
708
CREATE  TABLE IF NOT EXISTS `default_schema`.`soil_observation` (
709
  `soil_observation` TEXT NOT NULL ,
710
  PRIMARY KEY (`soil_observation`) ,
711
  CONSTRAINT `fk_soil_observation_location_observation1`
712
    FOREIGN KEY (`soil_observation` )
713
    REFERENCES `default_schema`.`location_observation` (`location_observation` )
714
    ON DELETE NO ACTION
715
    ON UPDATE NO ACTION)
716
ENGINE = InnoDB
717
DEFAULT CHARACTER SET = latin1
718
COLLATE = latin1_swedish_ci;
719

  
720

  
721
-- -----------------------------------------------------
722
-- Table `default_schema`.`subplot`
723
-- -----------------------------------------------------
724
CREATE  TABLE IF NOT EXISTS `default_schema`.`subplot` (
725
  `subplot` TEXT NOT NULL ,
726
  PRIMARY KEY (`subplot`) ,
727
  CONSTRAINT `fk_subplot_location1`
728
    FOREIGN KEY (`subplot` )
729
    REFERENCES `default_schema`.`location` (`location` )
730
    ON DELETE NO ACTION
731
    ON UPDATE NO ACTION)
732
ENGINE = InnoDB
733
DEFAULT CHARACTER SET = latin1
734
COLLATE = latin1_swedish_ci;
735

  
736

  
737
-- -----------------------------------------------------
738
-- Table `default_schema`.`geovalidation`
739
-- -----------------------------------------------------
740
CREATE  TABLE IF NOT EXISTS `default_schema`.`geovalidation` (
741
  `geovalidation` TEXT NOT NULL ,
742
  `coordinates` TEXT NOT NULL ,
743
  `placename` TEXT NOT NULL ,
744
  PRIMARY KEY (`geovalidation`) ,
745
  INDEX `fk_geovalidation_coordinates1` (`coordinates` ASC) ,
746
  INDEX `fk_geovalidation_placename1` (`placename` ASC) ,
747
  CONSTRAINT `fk_geovalidation_record1`
748
    FOREIGN KEY (`geovalidation` )
749
    REFERENCES `default_schema`.`record` (`record` )
750
    ON DELETE CASCADE
751
    ON UPDATE CASCADE,
752
  CONSTRAINT `fk_geovalidation_coordinates1`
753
    FOREIGN KEY (`coordinates` )
754
    REFERENCES `default_schema`.`coordinates` (`coordinates` )
755
    ON DELETE NO ACTION
756
    ON UPDATE NO ACTION,
757
  CONSTRAINT `fk_geovalidation_placename1`
758
    FOREIGN KEY (`placename` )
759
    REFERENCES `default_schema`.`named_place` (`named_place` )
760
    ON DELETE NO ACTION
761
    ON UPDATE NO ACTION)
762
ENGINE = InnoDB
763
DEFAULT CHARACTER SET = latin1
764
COLLATE = latin1_swedish_ci;
765

  
766

  
767
-- -----------------------------------------------------
768
-- Table `default_schema`.`project`
769
-- -----------------------------------------------------
770
CREATE  TABLE IF NOT EXISTS `default_schema`.`project` (
771
  `project` TEXT NOT NULL ,
772
  PRIMARY KEY (`project`) ,
773
  CONSTRAINT `fk_project_event1`
774
    FOREIGN KEY (`project` )
775
    REFERENCES `default_schema`.`event` (`event` )
776
    ON DELETE NO ACTION
777
    ON UPDATE NO ACTION)
778
ENGINE = InnoDB
779
DEFAULT CHARACTER SET = latin1
780
COLLATE = latin1_swedish_ci;
781

  
782

  
783
-- -----------------------------------------------------
784
-- Table `default_schema`.`party`
785
-- -----------------------------------------------------
786
CREATE  TABLE IF NOT EXISTS `default_schema`.`party` (
787
  `party` TEXT NOT NULL ,
788
  PRIMARY KEY (`party`) ,
789
  CONSTRAINT `fk_collection_source10`
790
    FOREIGN KEY (`party` )
791
    REFERENCES `default_schema`.`source` (`source` )
792
    ON DELETE NO ACTION
793
    ON UPDATE NO ACTION)
794
ENGINE = InnoDB
795
DEFAULT CHARACTER SET = latin1
796
COLLATE = latin1_swedish_ci;
797

  
798

  
799
-- -----------------------------------------------------
800
-- Table `default_schema`.`first_publisher`
801
-- -----------------------------------------------------
802
CREATE  TABLE IF NOT EXISTS `default_schema`.`first_publisher` (
803
  `first_publisher` TEXT NOT NULL ,
804
  PRIMARY KEY (`first_publisher`) ,
805
  CONSTRAINT `fk_collection_source100`
806
    FOREIGN KEY (`first_publisher` )
807
    REFERENCES `default_schema`.`source` (`source` )
808
    ON DELETE NO ACTION
809
    ON UPDATE NO ACTION)
810
ENGINE = InnoDB
811
DEFAULT CHARACTER SET = latin1
812
COLLATE = latin1_swedish_ci;
813

  
814

  
815

  
816
SET SQL_MODE=@OLD_SQL_MODE;
817
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
818
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Also available in: Unified diff