Project

General

Profile

1
-- MySQL dump 10.13  Distrib 5.5.32, for debian-linux-gnu (x86_64)
2
--
3
-- Host: localhost    Database: VegCore
4
-- ------------------------------------------------------
5
-- Server version	5.5.32-0ubuntu0.12.04.1
6

    
7
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
/*!40101 SET NAMES utf8 */;
11
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
/*!40103 SET TIME_ZONE='+00:00' */;
13
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17

    
18
--
19
-- Current Database: `VegCore`
20
--
21

    
22
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `VegCore` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */;
23

    
24
USE `VegCore`;
25

    
26
--
27
-- Table structure for table `aggregate_observation`
28
--
29

    
30
/*!40101 SET @saved_cs_client     = @@character_set_client */;
31
/*!40101 SET character_set_client = utf8 */;
32
CREATE TABLE `aggregate_observation` (
33
  `id` varbinary(767) NOT NULL,
34
  `occurrence_status` varbinary(767) DEFAULT NULL,
35
  PRIMARY KEY (`id`),
36
  CONSTRAINT `fk_taxon_presence_taxon_determination10` FOREIGN KEY (`id`) REFERENCES `taxon_determination` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
37
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
38
/*!40101 SET character_set_client = @saved_cs_client */;
39

    
40
--
41
-- Dumping data for table `aggregate_observation`
42
--
43

    
44
/*!40000 ALTER TABLE `aggregate_observation` DISABLE KEYS */;
45
/*!40000 ALTER TABLE `aggregate_observation` ENABLE KEYS */;
46

    
47
--
48
-- Table structure for table `base_class`
49
--
50

    
51
/*!40101 SET @saved_cs_client     = @@character_set_client */;
52
/*!40101 SET character_set_client = utf8 */;
53
CREATE TABLE `base_class` (
54
  `id` varbinary(767) NOT NULL,
55
  `referenced_class` varbinary(767) NOT NULL,
56
  PRIMARY KEY (`id`),
57
  KEY `fk_base_class_referenced_class1_idx` (`referenced_class`),
58
  CONSTRAINT `fk_base_class_referenced_class1` FOREIGN KEY (`referenced_class`) REFERENCES `referenced_class` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
59
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
60
/*!40101 SET character_set_client = @saved_cs_client */;
61

    
62
--
63
-- Dumping data for table `base_class`
64
--
65

    
66
/*!40000 ALTER TABLE `base_class` DISABLE KEYS */;
67
/*!40000 ALTER TABLE `base_class` ENABLE KEYS */;
68

    
69
--
70
-- Table structure for table `collection`
71
--
72

    
73
/*!40101 SET @saved_cs_client     = @@character_set_client */;
74
/*!40101 SET character_set_client = utf8 */;
75
CREATE TABLE `collection` (
76
  `id` varbinary(767) NOT NULL,
77
  `institution` varbinary(767) NOT NULL,
78
  `name` varbinary(767) NOT NULL,
79
  PRIMARY KEY (`id`),
80
  UNIQUE KEY `collection_unique` (`institution`,`name`),
81
  KEY `fk_collection_organization1_idx` (`institution`),
82
  KEY `fk_collection_source1_idx` (`id`),
83
  CONSTRAINT `fk_collection_source1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
84
  CONSTRAINT `fk_collection_organization1` FOREIGN KEY (`institution`) REFERENCES `organization` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
85
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"the collection within the institution where a specimen is held" ("Brad Boyle":https://projects.nceas.ucsb.edu/nceas/attachments/download/621/vegbien_identifier_examples.xlsx#terms/collectionCode)';
86
/*!40101 SET character_set_client = @saved_cs_client */;
87

    
88
--
89
-- Dumping data for table `collection`
90
--
91

    
92
/*!40000 ALTER TABLE `collection` DISABLE KEYS */;
93
/*!40000 ALTER TABLE `collection` ENABLE KEYS */;
94

    
95
--
96
-- Table structure for table `community`
97
--
98

    
99
/*!40101 SET @saved_cs_client     = @@character_set_client */;
100
/*!40101 SET character_set_client = utf8 */;
101
CREATE TABLE `community` (
102
  `id` varbinary(767) NOT NULL,
103
  `name` varbinary(767) NOT NULL,
104
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
105
  PRIMARY KEY (`id`),
106
  CONSTRAINT `fk_community_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
107
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"A community type is an abstract grouping of organisms that tend to co-occur on the landscape due to shared ecological requirements or preferences. May be designated by syntaxon or physiognomic types." ([[VegCore#VegX|VegX]])';
108
/*!40101 SET character_set_client = @saved_cs_client */;
109

    
110
--
111
-- Dumping data for table `community`
112
--
113

    
114
/*!40000 ALTER TABLE `community` DISABLE KEYS */;
115
/*!40000 ALTER TABLE `community` ENABLE KEYS */;
116

    
117
--
118
-- Table structure for table `data_owner`
119
--
120

    
121
/*!40101 SET @saved_cs_client     = @@character_set_client */;
122
/*!40101 SET character_set_client = utf8 */;
123
CREATE TABLE `data_owner` (
124
  `id` varbinary(767) NOT NULL,
125
  `use_conditions` varbinary(767) DEFAULT NULL COMMENT 'citation requirements, etc.',
126
  PRIMARY KEY (`id`),
127
  CONSTRAINT `fk_party_list_entry_record10` FOREIGN KEY (`id`) REFERENCES `party_list_entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
128
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
129
/*!40101 SET character_set_client = @saved_cs_client */;
130

    
131
--
132
-- Dumping data for table `data_owner`
133
--
134

    
135
/*!40000 ALTER TABLE `data_owner` DISABLE KEYS */;
136
/*!40000 ALTER TABLE `data_owner` ENABLE KEYS */;
137

    
138
--
139
-- Table structure for table `dataset`
140
--
141

    
142
/*!40101 SET @saved_cs_client     = @@character_set_client */;
143
/*!40101 SET character_set_client = utf8 */;
144
CREATE TABLE `dataset` (
145
  `id` varbinary(767) NOT NULL,
146
  `name` varbinary(767) NOT NULL,
147
  `contacts` varbinary(767) NOT NULL COMMENT 'contact person(s) to ask about attribution questions. there should always be at least one contact person. if unknown, the person loading the data should set this to themselves.',
148
  `parent` varbinary(767) DEFAULT NULL COMMENT 'this provides a containment relationship, which differs from the attribution relationship provided by dataset_source. e.g. the GBIF.ARIZ dataset is contained within a specific GBIF *dataset* (the parent), but was obtained from the GBIF *organization* (the dataset_source). ARIZ is then the first_publisher.',
149
  `dataset_source` varbinary(767) DEFAULT NULL COMMENT 'where the data in the dataset came from (as opposed to where the metadata *about* the dataset came from, which is in source, inherited from traceable); = Brad.vegpath.org?attribution.proximate_data_provider',
150
  `first_publisher` varbinary(767) DEFAULT NULL COMMENT '= Brad.vegpath.org?attribution.data_publisher, Brad.vegpath.org?data_provenance.primarydataprovider',
151
  `data_owners` varbinary(767) DEFAULT NULL COMMENT 'parties who must be given attribution, such as copyrightholders. this includes all aggregators through which the data has passed. = Brad.vegpath.org?attribution.data_indexer',
152
  `access_rights` varbinary(767) DEFAULT NULL COMMENT 'e.g. public, private, by request, metadata only',
153
  `use_conditions` varbinary(767) DEFAULT NULL COMMENT 'citation requirements, etc. this is the combination of all the use_conditions of the data_owners.',
154
  PRIMARY KEY (`id`),
155
  UNIQUE KEY `dataset_unique` (`parent`,`name`),
156
  KEY `fk_source_party_list1_idx` (`data_owners`),
157
  KEY `fk_source_party1_idx` (`contacts`),
158
  KEY `fk_dataset_dataset1_idx` (`parent`),
159
  KEY `fk_source_party2_idx` (`first_publisher`),
160
  KEY `dataset_dataset_source_fkey1_idx` (`dataset_source`),
161
  CONSTRAINT `dataset_dataset_source_fkey1` FOREIGN KEY (`dataset_source`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
162
  CONSTRAINT `fk_dataset_dataset1` FOREIGN KEY (`parent`) REFERENCES `dataset` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
163
  CONSTRAINT `fk_dataset_source1` FOREIGN KEY (`id`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
164
  CONSTRAINT `fk_source_party1` FOREIGN KEY (`contacts`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
165
  CONSTRAINT `fk_source_party2` FOREIGN KEY (`first_publisher`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
166
  CONSTRAINT `fk_source_party_list1` FOREIGN KEY (`data_owners`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
167
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='a collection of records from the same place, with the same attribution requirements';
168
/*!40101 SET character_set_client = @saved_cs_client */;
169

    
170
--
171
-- Dumping data for table `dataset`
172
--
173

    
174
/*!40000 ALTER TABLE `dataset` DISABLE KEYS */;
175
/*!40000 ALTER TABLE `dataset` ENABLE KEYS */;
176

    
177
--
178
-- Table structure for table `derived_class`
179
--
180

    
181
/*!40101 SET @saved_cs_client     = @@character_set_client */;
182
/*!40101 SET character_set_client = utf8 */;
183
CREATE TABLE `derived_class` (
184
  `id` varbinary(767) NOT NULL,
185
  PRIMARY KEY (`id`),
186
  CONSTRAINT `fk_derived_class_base_class1` FOREIGN KEY (`id`) REFERENCES `base_class` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
187
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
188
/*!40101 SET character_set_client = @saved_cs_client */;
189

    
190
--
191
-- Dumping data for table `derived_class`
192
--
193

    
194
/*!40000 ALTER TABLE `derived_class` DISABLE KEYS */;
195
/*!40000 ALTER TABLE `derived_class` ENABLE KEYS */;
196

    
197
--
198
-- Table structure for table `event`
199
--
200

    
201
/*!40101 SET @saved_cs_client     = @@character_set_client */;
202
/*!40101 SET character_set_client = utf8 */;
203
CREATE TABLE `event` (
204
  `id` varbinary(767) NOT NULL,
205
  `parent` varbinary(767) DEFAULT NULL,
206
  `subject` varbinary(767) DEFAULT NULL COMMENT 'what was observed',
207
  `name` varbinary(767) DEFAULT NULL,
208
  `date_range` varbinary(767) DEFAULT NULL,
209
  `participants` varbinary(767) DEFAULT NULL,
210
  PRIMARY KEY (`id`),
211
  UNIQUE KEY `event_unique_within_parent_by_name` (`parent`,`name`),
212
  UNIQUE KEY `event_unique_within_subject_by_date` (`subject`,`date_range`,`participants`),
213
  UNIQUE KEY `event_unique_within_parent_by_subject` (`parent`,`subject`),
214
  KEY `fk_event1_idx` (`parent`),
215
  KEY `fk_event_party_list1_idx` (`participants`),
216
  KEY `fk_event_place1_idx` (`subject`),
217
  KEY `event_unique_within_subject_by_name` (`subject`,`name`),
218
  CONSTRAINT `fk_event_party_list1` FOREIGN KEY (`participants`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
219
  CONSTRAINT `fk_event1` FOREIGN KEY (`parent`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
220
  CONSTRAINT `fk_event_place1` FOREIGN KEY (`subject`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
221
  CONSTRAINT `fk_event_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
222
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"an action that occurs at a place and during a period of time" ("DwC":http://rs.tdwg.org/dwc/terms/#Event)';
223
/*!40101 SET character_set_client = @saved_cs_client */;
224

    
225
--
226
-- Dumping data for table `event`
227
--
228

    
229
/*!40000 ALTER TABLE `event` DISABLE KEYS */;
230
/*!40000 ALTER TABLE `event` ENABLE KEYS */;
231

    
232
--
233
-- Table structure for table `geological_context`
234
--
235

    
236
/*!40101 SET @saved_cs_client     = @@character_set_client */;
237
/*!40101 SET character_set_client = utf8 */;
238
CREATE TABLE `geological_context` (
239
  `id` varbinary(767) NOT NULL,
240
  `name` varbinary(767) NOT NULL,
241
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
242
  PRIMARY KEY (`id`),
243
  CONSTRAINT `fk_geological_context_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
244
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"information pertaining to a location within a geological context, such as stratigraphy" ("DwC":http://rs.tdwg.org/dwc/terms/#GeologicalContext)';
245
/*!40101 SET character_set_client = @saved_cs_client */;
246

    
247
--
248
-- Dumping data for table `geological_context`
249
--
250

    
251
/*!40000 ALTER TABLE `geological_context` DISABLE KEYS */;
252
/*!40000 ALTER TABLE `geological_context` ENABLE KEYS */;
253

    
254
--
255
-- Table structure for table `geopath`
256
--
257

    
258
/*!40101 SET @saved_cs_client     = @@character_set_client */;
259
/*!40101 SET character_set_client = utf8 */;
260
CREATE TABLE `geopath` (
261
  `id` varbinary(767) NOT NULL,
262
  `continent` varbinary(767) DEFAULT NULL,
263
  `country` varbinary(767) DEFAULT NULL,
264
  `state_province` varbinary(767) DEFAULT NULL,
265
  `county` varbinary(767) DEFAULT NULL,
266
  `municipality` varbinary(767) DEFAULT NULL,
267
  `ranks` set('hstore') COLLATE utf8_bin DEFAULT NULL,
268
  PRIMARY KEY (`id`)
269
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A named region';
270
/*!40101 SET character_set_client = @saved_cs_client */;
271

    
272
--
273
-- Dumping data for table `geopath`
274
--
275

    
276
/*!40000 ALTER TABLE `geopath` DISABLE KEYS */;
277
/*!40000 ALTER TABLE `geopath` ENABLE KEYS */;
278

    
279
--
280
-- Table structure for table `geoplace`
281
--
282

    
283
/*!40101 SET @saved_cs_client     = @@character_set_client */;
284
/*!40101 SET character_set_client = utf8 */;
285
CREATE TABLE `geoplace` (
286
  `id` varbinary(767) NOT NULL,
287
  `latitude_deg` varbinary(767) NOT NULL,
288
  `longitude_deg` varbinary(767) NOT NULL,
289
  `boundary_WKT` varbinary(767) NOT NULL DEFAULT 'point',
290
  `official_name` varbinary(767) DEFAULT NULL,
291
  PRIMARY KEY (`id`),
292
  CONSTRAINT `fk_geoplace_place1` FOREIGN KEY (`id`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
293
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A numerically-defined point';
294
/*!40101 SET character_set_client = @saved_cs_client */;
295

    
296
--
297
-- Dumping data for table `geoplace`
298
--
299

    
300
/*!40000 ALTER TABLE `geoplace` DISABLE KEYS */;
301
/*!40000 ALTER TABLE `geoplace` ENABLE KEYS */;
302

    
303
--
304
-- Table structure for table `georeferencing`
305
--
306

    
307
/*!40101 SET @saved_cs_client     = @@character_set_client */;
308
/*!40101 SET character_set_client = utf8 */;
309
CREATE TABLE `georeferencing` (
310
  `id` varbinary(767) NOT NULL,
311
  `input_place` varbinary(767) NOT NULL,
312
  `geoplace` varbinary(767) DEFAULT NULL,
313
  `georeferenced_by` varbinary(767) DEFAULT NULL,
314
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
315
  PRIMARY KEY (`id`),
316
  KEY `fk_georef_place1_idx` (`input_place`),
317
  KEY `fk_georeferencing_party_list1_idx` (`georeferenced_by`),
318
  KEY `fk_georeferencing_geoplace1_idx` (`geoplace`),
319
  CONSTRAINT `fk_georeferencing_geoplace1` FOREIGN KEY (`geoplace`) REFERENCES `geoplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
320
  CONSTRAINT `fk_georeferencing_party_list1` FOREIGN KEY (`georeferenced_by`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
321
  CONSTRAINT `fk_georef_place1` FOREIGN KEY (`input_place`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
322
  CONSTRAINT `fk_geovalidation_record100` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
323
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='also stored GNRS results';
324
/*!40101 SET character_set_client = @saved_cs_client */;
325

    
326
--
327
-- Dumping data for table `georeferencing`
328
--
329

    
330
/*!40000 ALTER TABLE `georeferencing` DISABLE KEYS */;
331
/*!40000 ALTER TABLE `georeferencing` ENABLE KEYS */;
332

    
333
--
334
-- Table structure for table `geovalidatable_place`
335
--
336

    
337
/*!40101 SET @saved_cs_client     = @@character_set_client */;
338
/*!40101 SET character_set_client = utf8 */;
339
CREATE TABLE `geovalidatable_place` (
340
  `id` varbinary(767) NOT NULL,
341
  `parent` varbinary(767) NOT NULL COMMENT 'the parent geoplace',
342
  PRIMARY KEY (`id`),
343
  KEY `fk_geovalidatable_place_geoplace1_idx` (`parent`),
344
  CONSTRAINT `fk_nested_geoplace_geoplace1` FOREIGN KEY (`id`) REFERENCES `geoplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
345
  CONSTRAINT `fk_geovalidatable_place_geoplace1` FOREIGN KEY (`parent`) REFERENCES `geoplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
346
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='stores only scrubbed geoplaces (GADM places, and distinct point coordinates that GNRS says should be located within them)';
347
/*!40101 SET character_set_client = @saved_cs_client */;
348

    
349
--
350
-- Dumping data for table `geovalidatable_place`
351
--
352

    
353
/*!40000 ALTER TABLE `geovalidatable_place` DISABLE KEYS */;
354
/*!40000 ALTER TABLE `geovalidatable_place` ENABLE KEYS */;
355

    
356
--
357
-- Table structure for table `geovalidation`
358
--
359

    
360
/*!40101 SET @saved_cs_client     = @@character_set_client */;
361
/*!40101 SET character_set_client = utf8 */;
362
CREATE TABLE `geovalidation` (
363
  `id` varbinary(767) NOT NULL,
364
  `input_geoplace` varbinary(767) NOT NULL,
365
  `geovalid` tinyint(1) NOT NULL,
366
  `lat_long_domain_valid` tinyint(1) NOT NULL,
367
  `lat_long_in_place_ranks` set('hstore') COLLATE utf8_bin DEFAULT NULL,
368
  `corrected_geoplace` varbinary(767) DEFAULT NULL,
369
  PRIMARY KEY (`id`),
370
  KEY `fk_geovalidation_geoplace1_idx` (`input_geoplace`),
371
  KEY `fk_geovalidation_geoplace2_idx` (`corrected_geoplace`),
372
  CONSTRAINT `fk_geovalidation_geoplace1` FOREIGN KEY (`input_geoplace`) REFERENCES `geovalidatable_place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
373
  CONSTRAINT `fk_geovalidation_geoplace2` FOREIGN KEY (`corrected_geoplace`) REFERENCES `geovalidatable_place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
374
  CONSTRAINT `fk_geovalidation_georeferencing1` FOREIGN KEY (`id`) REFERENCES `georeferencing` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
375
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='The accuracy of the [[VegCore#Coordinates|Coordinates]], taking into account the [[VegCore#Placename|Placename]]';
376
/*!40101 SET character_set_client = @saved_cs_client */;
377

    
378
--
379
-- Dumping data for table `geovalidation`
380
--
381

    
382
/*!40000 ALTER TABLE `geovalidation` DISABLE KEYS */;
383
/*!40000 ALTER TABLE `geovalidation` ENABLE KEYS */;
384

    
385
--
386
-- Table structure for table `individual`
387
--
388

    
389
/*!40101 SET @saved_cs_client     = @@character_set_client */;
390
/*!40101 SET character_set_client = utf8 */;
391
CREATE TABLE `individual` (
392
  `id` varbinary(767) NOT NULL,
393
  `identifying_place` varbinary(767) DEFAULT NULL COMMENT 'subplace within plot. not specified for specimens since their coordinates are usually not precise enough to identify an individual.',
394
  `tag` varbinary(767) DEFAULT NULL,
395
  `tag_history` set('hstore') COLLATE utf8_bin DEFAULT NULL,
396
  PRIMARY KEY (`id`),
397
  KEY `fk_individual_subplace1_idx` (`identifying_place`),
398
  CONSTRAINT `fk_individual_record1` FOREIGN KEY (`id`) REFERENCES `reobservable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
399
  CONSTRAINT `fk_individual_subplace1` FOREIGN KEY (`identifying_place`) REFERENCES `subplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
400
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A distinct biological organism';
401
/*!40101 SET character_set_client = @saved_cs_client */;
402

    
403
--
404
-- Dumping data for table `individual`
405
--
406

    
407
/*!40000 ALTER TABLE `individual` DISABLE KEYS */;
408
/*!40000 ALTER TABLE `individual` ENABLE KEYS */;
409

    
410
--
411
-- Table structure for table `individual_count`
412
--
413

    
414
/*!40101 SET @saved_cs_client     = @@character_set_client */;
415
/*!40101 SET character_set_client = utf8 */;
416
CREATE TABLE `individual_count` (
417
  `id` varbinary(767) NOT NULL,
418
  `parent` varbinary(767) NOT NULL COMMENT 'the taxon_presence for the taxon as a whole (not subdivided by size_class, etc.)',
419
  `size_class` varbinary(767) DEFAULT NULL,
420
  `aggregating_traits` set('hstore') COLLATE utf8_bin DEFAULT NULL,
421
  `count` int(11) DEFAULT NULL,
422
  PRIMARY KEY (`id`),
423
  KEY `fk_aggregate_observation_taxon_presence1_idx` (`parent`),
424
  KEY `fk_aggregate_observation_size_class1_idx` (`size_class`),
425
  CONSTRAINT `fk_aggregate_observation_size_class1` FOREIGN KEY (`size_class`) REFERENCES `size_class` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
426
  CONSTRAINT `fk_aggregate_observation_taxon_presence1` FOREIGN KEY (`parent`) REFERENCES `taxon_presence` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
427
  CONSTRAINT `fk_individual_count_taxon_presence1` FOREIGN KEY (`id`) REFERENCES `taxon_presence` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
428
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='= VegBank.vegpath.org?stemCount';
429
/*!40101 SET character_set_client = @saved_cs_client */;
430

    
431
--
432
-- Dumping data for table `individual_count`
433
--
434

    
435
/*!40000 ALTER TABLE `individual_count` DISABLE KEYS */;
436
/*!40000 ALTER TABLE `individual_count` ENABLE KEYS */;
437

    
438
--
439
-- Table structure for table `individual_observation`
440
--
441

    
442
/*!40101 SET @saved_cs_client     = @@character_set_client */;
443
/*!40101 SET character_set_client = utf8 */;
444
CREATE TABLE `individual_observation` (
445
  `id` varbinary(767) NOT NULL,
446
  `subject` varbinary(767) DEFAULT NULL COMMENT 'optional because an individual_observation cannot have an associated individual unless the individual is traceable to a specific plant',
447
  `specimenholder_institutions` varbinary(767) DEFAULT NULL COMMENT 'institutions which store specimens from this plant. when provided, the taxon_occurrence should have an autogenerated current_observation that merges together all the individual_observations for these institutions'' specimens.',
448
  PRIMARY KEY (`id`),
449
  KEY `fk_individual_observation_individual1_idx` (`subject`),
450
  KEY `individual_observation_id_fkey1_idx` (`specimenholder_institutions`),
451
  CONSTRAINT `individual_observation_id_fkey1` FOREIGN KEY (`specimenholder_institutions`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
452
  CONSTRAINT `fk_individual_observation_individual1` FOREIGN KEY (`subject`) REFERENCES `individual` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
453
  CONSTRAINT `fk_individual_observation_taxon_occurrence1` FOREIGN KEY (`id`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
454
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='An observation of an [[VegCore#Individual|Individual]]; inherited fields: place: contains the place the individual was observed at';
455
/*!40101 SET character_set_client = @saved_cs_client */;
456

    
457
--
458
-- Dumping data for table `individual_observation`
459
--
460

    
461
/*!40000 ALTER TABLE `individual_observation` DISABLE KEYS */;
462
/*!40000 ALTER TABLE `individual_observation` ENABLE KEYS */;
463

    
464
--
465
-- Table structure for table `method`
466
--
467

    
468
/*!40101 SET @saved_cs_client     = @@character_set_client */;
469
/*!40101 SET character_set_client = utf8 */;
470
CREATE TABLE `method` (
471
  `id` varbinary(767) NOT NULL,
472
  `name` varbinary(767) DEFAULT NULL,
473
  `parent` varbinary(767) DEFAULT NULL,
474
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
475
  PRIMARY KEY (`id`),
476
  KEY `fk_method_method1_idx` (`parent`),
477
  CONSTRAINT `fk_method_method1` FOREIGN KEY (`parent`) REFERENCES `method` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
478
  CONSTRAINT `fk_method_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
479
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"A specific method definition followed in the creation of the dataset. Each method links to a protocol and literature citation reference. A protocol may have many method or steps." ("VegX":http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#/methods/method)';
480
/*!40101 SET character_set_client = @saved_cs_client */;
481

    
482
--
483
-- Dumping data for table `method`
484
--
485

    
486
/*!40000 ALTER TABLE `method` DISABLE KEYS */;
487
/*!40000 ALTER TABLE `method` ENABLE KEYS */;
488

    
489
--
490
-- Table structure for table `organization`
491
--
492

    
493
/*!40101 SET @saved_cs_client     = @@character_set_client */;
494
/*!40101 SET character_set_client = utf8 */;
495
CREATE TABLE `organization` (
496
  `id` varbinary(767) NOT NULL,
497
  `name` varbinary(767) NOT NULL,
498
  `parent` varbinary(767) DEFAULT NULL,
499
  PRIMARY KEY (`id`),
500
  UNIQUE KEY `organization_unique` (`parent`,`name`),
501
  KEY `fk_organization_organization1_idx` (`parent`),
502
  CONSTRAINT `fk_organization_organization1` FOREIGN KEY (`parent`) REFERENCES `organization` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
503
  CONSTRAINT `fk_organization_party1` FOREIGN KEY (`id`) REFERENCES `party` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
504
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
505
/*!40101 SET character_set_client = @saved_cs_client */;
506

    
507
--
508
-- Dumping data for table `organization`
509
--
510

    
511
/*!40000 ALTER TABLE `organization` DISABLE KEYS */;
512
/*!40000 ALTER TABLE `organization` ENABLE KEYS */;
513

    
514
--
515
-- Table structure for table `party`
516
--
517

    
518
/*!40101 SET @saved_cs_client     = @@character_set_client */;
519
/*!40101 SET character_set_client = utf8 */;
520
CREATE TABLE `party` (
521
  `id` varbinary(767) NOT NULL,
522
  PRIMARY KEY (`id`),
523
  CONSTRAINT `fk_collection_source10` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
524
  CONSTRAINT `fk_party_source1` FOREIGN KEY (`id`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
525
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
526
/*!40101 SET character_set_client = @saved_cs_client */;
527

    
528
--
529
-- Dumping data for table `party`
530
--
531

    
532
/*!40000 ALTER TABLE `party` DISABLE KEYS */;
533
/*!40000 ALTER TABLE `party` ENABLE KEYS */;
534

    
535
--
536
-- Table structure for table `party_list`
537
--
538

    
539
/*!40101 SET @saved_cs_client     = @@character_set_client */;
540
/*!40101 SET character_set_client = utf8 */;
541
CREATE TABLE `party_list` (
542
  `id` varbinary(767) NOT NULL,
543
  `count` int(11) NOT NULL,
544
  `array` set('text[]') COLLATE utf8_bin DEFAULT NULL COMMENT 'an array combining all the list entries. if specified, a trigger will autogenerate party_list_entries from this field. if not specified, will be autopopulated whenever a party_list_entry is added.',
545
  PRIMARY KEY (`id`),
546
  CONSTRAINT `fk_collection_source100` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
547
  CONSTRAINT `party_list_id_fkey1` FOREIGN KEY (`id`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
548
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
549
/*!40101 SET character_set_client = @saved_cs_client */;
550

    
551
--
552
-- Dumping data for table `party_list`
553
--
554

    
555
/*!40000 ALTER TABLE `party_list` DISABLE KEYS */;
556
/*!40000 ALTER TABLE `party_list` ENABLE KEYS */;
557

    
558
--
559
-- Table structure for table `party_list_entry`
560
--
561

    
562
/*!40101 SET @saved_cs_client     = @@character_set_client */;
563
/*!40101 SET character_set_client = utf8 */;
564
CREATE TABLE `party_list_entry` (
565
  `id` varbinary(767) NOT NULL,
566
  `list` varbinary(767) NOT NULL,
567
  `party` varbinary(767) NOT NULL,
568
  `role` varbinary(767) DEFAULT NULL,
569
  `sort_order` int(11) DEFAULT NULL,
570
  PRIMARY KEY (`id`),
571
  KEY `fk_party_list_has_party_party1_idx` (`party`),
572
  KEY `fk_party_list_entry_party_list1_idx` (`list`),
573
  CONSTRAINT `fk_party_list_has_party_party1` FOREIGN KEY (`party`) REFERENCES `party` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
574
  CONSTRAINT `fk_party_list_entry_party_list1` FOREIGN KEY (`list`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
575
  CONSTRAINT `fk_party_list_entry_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
576
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
577
/*!40101 SET character_set_client = @saved_cs_client */;
578

    
579
--
580
-- Dumping data for table `party_list_entry`
581
--
582

    
583
/*!40000 ALTER TABLE `party_list_entry` DISABLE KEYS */;
584
/*!40000 ALTER TABLE `party_list_entry` ENABLE KEYS */;
585

    
586
--
587
-- Table structure for table `person`
588
--
589

    
590
/*!40101 SET @saved_cs_client     = @@character_set_client */;
591
/*!40101 SET character_set_client = utf8 */;
592
CREATE TABLE `person` (
593
  `id` varbinary(767) NOT NULL,
594
  `name` varbinary(767) NOT NULL,
595
  `organization` varbinary(767) DEFAULT NULL,
596
  PRIMARY KEY (`id`),
597
  UNIQUE KEY `person_unique` (`organization`,`name`),
598
  KEY `fk_person_organization1_idx` (`organization`),
599
  CONSTRAINT `fk_person_organization1` FOREIGN KEY (`organization`) REFERENCES `organization` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
600
  CONSTRAINT `fk_organization_party10` FOREIGN KEY (`id`) REFERENCES `party` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
601
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
602
/*!40101 SET character_set_client = @saved_cs_client */;
603

    
604
--
605
-- Dumping data for table `person`
606
--
607

    
608
/*!40000 ALTER TABLE `person` DISABLE KEYS */;
609
/*!40000 ALTER TABLE `person` ENABLE KEYS */;
610

    
611
--
612
-- Table structure for table `place`
613
--
614

    
615
/*!40101 SET @saved_cs_client     = @@character_set_client */;
616
/*!40101 SET character_set_client = utf8 */;
617
CREATE TABLE `place` (
618
  `id` varbinary(767) NOT NULL,
619
  `parent` varbinary(767) DEFAULT NULL,
620
  `rank` varbinary(767) DEFAULT NULL,
621
  `name` varbinary(767) DEFAULT NULL,
622
  `geopath` varbinary(767) DEFAULT NULL,
623
  `locality` varbinary(767) DEFAULT NULL,
624
  `verbatim` set('hstore') COLLATE utf8_bin DEFAULT NULL COMMENT 'for verbatim coordinates, etc.',
625
  PRIMARY KEY (`id`),
626
  KEY `fk_place1_idx` (`parent`),
627
  KEY `fk_place_geopath1_idx` (`geopath`),
628
  CONSTRAINT `fk_place1` FOREIGN KEY (`parent`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
629
  CONSTRAINT `fk_place_geopath1` FOREIGN KEY (`geopath`) REFERENCES `geopath` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
630
  CONSTRAINT `fk_place_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
631
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"A spatial region" ("DwC":http://rs.tdwg.org/dwc/terms/#dcterms:Location) or point';
632
/*!40101 SET character_set_client = @saved_cs_client */;
633

    
634
--
635
-- Dumping data for table `place`
636
--
637

    
638
/*!40000 ALTER TABLE `place` DISABLE KEYS */;
639
/*!40000 ALTER TABLE `place` ENABLE KEYS */;
640

    
641
--
642
-- Table structure for table `place_visit`
643
--
644

    
645
/*!40101 SET @saved_cs_client     = @@character_set_client */;
646
/*!40101 SET character_set_client = utf8 */;
647
CREATE TABLE `place_visit` (
648
  `id` varbinary(767) NOT NULL,
649
  `parent` varbinary(767) DEFAULT NULL COMMENT 'the concurrent observation of the parent place',
650
  `subject` varbinary(767) NOT NULL,
651
  `project` varbinary(767) DEFAULT NULL,
652
  `elevation_m` double DEFAULT NULL,
653
  `slope_incline_deg` double DEFAULT NULL,
654
  `slope_direction_deg_N` double DEFAULT NULL,
655
  `geological_context` varbinary(767) DEFAULT NULL,
656
  `community` varbinary(767) DEFAULT NULL,
657
  `observations` set('hstore') COLLATE utf8_bin DEFAULT NULL,
658
  PRIMARY KEY (`id`),
659
  KEY `fk_place_observation_place1_idx` (`subject`),
660
  KEY `fk_place_observation_geological_context1_idx` (`geological_context`),
661
  KEY `fk_place_observation_community1_idx` (`community`),
662
  KEY `place_observation_id_fkey1_idx` (`project`),
663
  KEY `place_visit_id_fkey1_idx` (`parent`),
664
  CONSTRAINT `place_observation_id_fkey1` FOREIGN KEY (`project`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
665
  CONSTRAINT `place_visit_id_fkey1` FOREIGN KEY (`parent`) REFERENCES `place_visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
666
  CONSTRAINT `fk_place_observation_community1` FOREIGN KEY (`community`) REFERENCES `community` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
667
  CONSTRAINT `fk_place_observation_event1` FOREIGN KEY (`id`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
668
  CONSTRAINT `fk_place_observation_geological_context1` FOREIGN KEY (`geological_context`) REFERENCES `geological_context` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
669
  CONSTRAINT `fk_place_observation_place1` FOREIGN KEY (`subject`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
670
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A sampling of a [[VegCore#Location|Location]]. = VegX.vegpath.org?plotObservation, VegBank.vegpath.org?observation (which was confusingly named) + some of VegBank.vegpath.org?plot (which is actually 1:1 with observation)';
671
/*!40101 SET character_set_client = @saved_cs_client */;
672

    
673
--
674
-- Dumping data for table `place_visit`
675
--
676

    
677
/*!40000 ALTER TABLE `place_visit` DISABLE KEYS */;
678
/*!40000 ALTER TABLE `place_visit` ENABLE KEYS */;
679

    
680
--
681
-- Table structure for table `plot`
682
--
683

    
684
/*!40101 SET @saved_cs_client     = @@character_set_client */;
685
/*!40101 SET character_set_client = utf8 */;
686
CREATE TABLE `plot` (
687
  `id` varbinary(767) NOT NULL,
688
  `area_m2` double DEFAULT NULL,
689
  `shape` varbinary(767) DEFAULT NULL,
690
  `length_m` varbinary(767) DEFAULT NULL,
691
  `width_m` varbinary(767) DEFAULT NULL,
692
  `azimuth_deg_N` varbinary(767) DEFAULT NULL,
693
  `boundary_WKT` varbinary(767) DEFAULT NULL,
694
  `dimensions` set('hstore') COLLATE utf8_bin DEFAULT NULL,
695
  PRIMARY KEY (`id`),
696
  CONSTRAINT `fk_subplot_place1` FOREIGN KEY (`id`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
697
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
698
/*!40101 SET character_set_client = @saved_cs_client */;
699

    
700
--
701
-- Dumping data for table `plot`
702
--
703

    
704
/*!40000 ALTER TABLE `plot` DISABLE KEYS */;
705
/*!40000 ALTER TABLE `plot` ENABLE KEYS */;
706

    
707
--
708
-- Table structure for table `project`
709
--
710

    
711
/*!40101 SET @saved_cs_client     = @@character_set_client */;
712
/*!40101 SET character_set_client = utf8 */;
713
CREATE TABLE `project` (
714
  `id` varbinary(767) NOT NULL,
715
  `name` varbinary(767) NOT NULL,
716
  `dataset` varbinary(767) DEFAULT NULL,
717
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
718
  PRIMARY KEY (`id`),
719
  UNIQUE KEY `project__unique` (`dataset`,`name`),
720
  KEY `project_id_fkey1_idx` (`dataset`),
721
  CONSTRAINT `project_id_fkey1` FOREIGN KEY (`dataset`) REFERENCES `dataset` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
722
  CONSTRAINT `fk_project_event1` FOREIGN KEY (`id`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
723
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A "project established to collect vegetation plot data. Each plot originates as part of a project." ("VegBank":http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=project&entity=dba_tabledescription&where=where_tablename)';
724
/*!40101 SET character_set_client = @saved_cs_client */;
725

    
726
--
727
-- Dumping data for table `project`
728
--
729

    
730
/*!40000 ALTER TABLE `project` DISABLE KEYS */;
731
/*!40000 ALTER TABLE `project` ENABLE KEYS */;
732

    
733
--
734
-- Table structure for table `record`
735
--
736

    
737
/*!40101 SET @saved_cs_client     = @@character_set_client */;
738
/*!40101 SET character_set_client = utf8 */;
739
CREATE TABLE `record` (
740
  `id` varbinary(767) NOT NULL,
741
  `scoping_dataset` varbinary(767) NOT NULL COMMENT 'the dataset that scopes the id_within_dataset',
742
  `id_within_dataset` varbinary(767) NOT NULL,
743
  `attribution_dataset` varbinary(767) NOT NULL COMMENT 'the dataset that provides attribution information. defaults to the scoping_dataset.',
744
  PRIMARY KEY (`id`),
745
  UNIQUE KEY `record_unique` (`scoping_dataset`,`id_within_dataset`),
746
  KEY `fk_record_source1_idx` (`scoping_dataset`),
747
  KEY `record_id_fkey2_idx` (`attribution_dataset`),
748
  CONSTRAINT `fk_record_source10` FOREIGN KEY (`scoping_dataset`) REFERENCES `dataset` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
749
  CONSTRAINT `fk_record_source2` FOREIGN KEY (`id`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
750
  CONSTRAINT `record_id_fkey2` FOREIGN KEY (`attribution_dataset`) REFERENCES `dataset` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
751
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='a collection of data relating to the same entity. this doesn''t have to be a row in a table, it can also be a paragraph of text relating to the same thing (e.g. a method description in a PDF). note that this is the record in the *source* data.';
752
/*!40101 SET character_set_client = @saved_cs_client */;
753

    
754
--
755
-- Dumping data for table `record`
756
--
757

    
758
/*!40000 ALTER TABLE `record` DISABLE KEYS */;
759
/*!40000 ALTER TABLE `record` ENABLE KEYS */;
760

    
761
--
762
-- Table structure for table `referenced_class`
763
--
764

    
765
/*!40101 SET @saved_cs_client     = @@character_set_client */;
766
/*!40101 SET character_set_client = utf8 */;
767
CREATE TABLE `referenced_class` (
768
  `id` varbinary(767) NOT NULL,
769
  PRIMARY KEY (`id`),
770
  CONSTRAINT `fk_example_record10` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
771
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
772
/*!40101 SET character_set_client = @saved_cs_client */;
773

    
774
--
775
-- Dumping data for table `referenced_class`
776
--
777

    
778
/*!40000 ALTER TABLE `referenced_class` DISABLE KEYS */;
779
/*!40000 ALTER TABLE `referenced_class` ENABLE KEYS */;
780

    
781
--
782
-- Table structure for table `reobservable`
783
--
784

    
785
/*!40101 SET @saved_cs_client     = @@character_set_client */;
786
/*!40101 SET character_set_client = utf8 */;
787
CREATE TABLE `reobservable` (
788
  `id` varbinary(767) NOT NULL,
789
  `orig_observation` varbinary(767) DEFAULT NULL,
790
  PRIMARY KEY (`id`),
791
  KEY `fk_reobservable_taxon_determination1_idx` (`orig_observation`),
792
  CONSTRAINT `fk_reobservable_taxon_determination1` FOREIGN KEY (`orig_observation`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
793
  CONSTRAINT `fk_reobservable_taxon_occurrence1` FOREIGN KEY (`id`) REFERENCES `taxon_occurrence` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
794
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Any entity on which [[VegCore#TaxonDetermination|TaxonDetermination]]s can be made';
795
/*!40101 SET character_set_client = @saved_cs_client */;
796

    
797
--
798
-- Dumping data for table `reobservable`
799
--
800

    
801
/*!40000 ALTER TABLE `reobservable` DISABLE KEYS */;
802
/*!40000 ALTER TABLE `reobservable` ENABLE KEYS */;
803

    
804
--
805
-- Table structure for table `size_class`
806
--
807

    
808
/*!40101 SET @saved_cs_client     = @@character_set_client */;
809
/*!40101 SET character_set_client = utf8 */;
810
CREATE TABLE `size_class` (
811
  `id` varbinary(767) NOT NULL,
812
  `diameter_min_m` double NOT NULL,
813
  `diameter_max_m` double NOT NULL,
814
  PRIMARY KEY (`id`),
815
  CONSTRAINT `fk_layer_stratum10` FOREIGN KEY (`id`) REFERENCES `method` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
816
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
817
/*!40101 SET character_set_client = @saved_cs_client */;
818

    
819
--
820
-- Dumping data for table `size_class`
821
--
822

    
823
/*!40000 ALTER TABLE `size_class` DISABLE KEYS */;
824
/*!40000 ALTER TABLE `size_class` ENABLE KEYS */;
825

    
826
--
827
-- Table structure for table `soil_observation`
828
--
829

    
830
/*!40101 SET @saved_cs_client     = @@character_set_client */;
831
/*!40101 SET character_set_client = utf8 */;
832
CREATE TABLE `soil_observation` (
833
  `id` varbinary(767) NOT NULL,
834
  `place_visit` varbinary(767) NOT NULL,
835
  `measurement_spot` varbinary(767) DEFAULT NULL,
836
  `observations` set('hstore') COLLATE utf8_bin DEFAULT NULL,
837
  PRIMARY KEY (`id`),
838
  KEY `fk_soil_observation_place_observation1_idx` (`place_visit`),
839
  KEY `fk_soil_observation_subplace1_idx` (`measurement_spot`),
840
  CONSTRAINT `fk_soil_observation_place_observation1` FOREIGN KEY (`place_visit`) REFERENCES `place_visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
841
  CONSTRAINT `fk_soil_observation_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
842
  CONSTRAINT `fk_soil_observation_subplace1` FOREIGN KEY (`measurement_spot`) REFERENCES `subplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
843
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A sampling of a [[VegCore#Location|Location]]''s soil';
844
/*!40101 SET character_set_client = @saved_cs_client */;
845

    
846
--
847
-- Dumping data for table `soil_observation`
848
--
849

    
850
/*!40000 ALTER TABLE `soil_observation` DISABLE KEYS */;
851
/*!40000 ALTER TABLE `soil_observation` ENABLE KEYS */;
852

    
853
--
854
-- Table structure for table `source`
855
--
856

    
857
/*!40101 SET @saved_cs_client     = @@character_set_client */;
858
/*!40101 SET character_set_client = utf8 */;
859
CREATE TABLE `source` (
860
  `id` varbinary(767) NOT NULL,
861
  `url` varbinary(767) NOT NULL COMMENT 'points to the source data and uniquely identifies the source',
862
  `name` varbinary(767) DEFAULT NULL COMMENT 'source names will be scrubbed *upon insert* so that the row always contains the most accurate data. this scrubbing may use the assistance of a thesaurus table.',
863
  `info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
864
  PRIMARY KEY (`id`),
865
  UNIQUE KEY `source__unique` (`url`)
866
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='where something came from; a "reference [...] cited within the database" ("VegBank":http://reference.VegBank.vegpath.org); = VegBank.vegpath.org?reference';
867
/*!40101 SET character_set_client = @saved_cs_client */;
868

    
869
--
870
-- Dumping data for table `source`
871
--
872

    
873
/*!40000 ALTER TABLE `source` DISABLE KEYS */;
874
/*!40000 ALTER TABLE `source` ENABLE KEYS */;
875

    
876
--
877
-- Table structure for table `specimen`
878
--
879

    
880
/*!40101 SET @saved_cs_client     = @@character_set_client */;
881
/*!40101 SET character_set_client = utf8 */;
882
CREATE TABLE `specimen` (
883
  `id` varbinary(767) NOT NULL,
884
  `individual_observation` varbinary(767) DEFAULT NULL COMMENT 'the plant the specimen was collected from and any observations about it',
885
  `id_within_individual` varbinary(767) DEFAULT NULL,
886
  `orig_collection` varbinary(767) DEFAULT NULL,
887
  `barcode` varbinary(767) DEFAULT NULL,
888
  `accession_number` varbinary(767) DEFAULT NULL,
889
  `defining_data` set('hstore') COLLATE utf8_bin DEFAULT NULL COMMENT 'of the observations made about the specimen in individual_observation.traits, this stores the subset that can be used to make a taxonomic redetermination. for a digital-only specimen, this would be the information that comprises the specimen (e.g. a photo, a sketch, or a description that is detailed enough to be able to make a redetermination). note that a taxon_presence without a physical voucher can still qualify as reobservable if a detailed description of it is provided here.',
890
  PRIMARY KEY (`id`),
891
  UNIQUE KEY `specimen_unique_in_individual` (`individual_observation`,`id_within_individual`),
892
  UNIQUE KEY `specimen_unique_in_collection_by_barcode` (`orig_collection`,`barcode`),
893
  UNIQUE KEY `specimen_unique_in_collection_by_accession_number` (`orig_collection`,`accession_number`),
894
  UNIQUE KEY `specimen_unique_in_individual_observation` (`individual_observation`,`id_within_individual`),
895
  KEY `fk_specimen_collection1_idx` (`orig_collection`),
896
  KEY `fk_specimen_individual_observation1_idx` (`individual_observation`),
897
  CONSTRAINT `fk_specimen_collection1` FOREIGN KEY (`orig_collection`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
898
  CONSTRAINT `fk_specimen_individual_observation1` FOREIGN KEY (`individual_observation`) REFERENCES `individual_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
899
  CONSTRAINT `fk_specimen_taxon_occurrence1` FOREIGN KEY (`id`) REFERENCES `reobservable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
900
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='something collected from a plant. this can be a physical "part of a plant" ("Wikipedia":http://en.wikipedia.org/wiki/Specimen), or a picture or description of the plant. when there are multiple specimen replicates (copies) of a specimen, each gets its own specimen_observation pointing to the same specimen.';
901
/*!40101 SET character_set_client = @saved_cs_client */;
902

    
903
--
904
-- Dumping data for table `specimen`
905
--
906

    
907
/*!40000 ALTER TABLE `specimen` DISABLE KEYS */;
908
/*!40000 ALTER TABLE `specimen` ENABLE KEYS */;
909

    
910
--
911
-- Table structure for table `specimen_observation`
912
--
913

    
914
/*!40101 SET @saved_cs_client     = @@character_set_client */;
915
/*!40101 SET character_set_client = utf8 */;
916
CREATE TABLE `specimen_observation` (
917
  `id` varbinary(767) NOT NULL,
918
  `subject` varbinary(767) NOT NULL,
919
  `description` varbinary(767) DEFAULT NULL,
920
  `current_collection` varbinary(767) DEFAULT NULL,
921
  `owner_collection` varbinary(767) DEFAULT NULL,
922
  PRIMARY KEY (`id`),
923
  KEY `fk_specimen_observation_specimen1_idx` (`subject`),
924
  KEY `specimen_observation_id_fkey1_idx` (`current_collection`),
925
  KEY `specimen_observation_id_fkey2_idx` (`owner_collection`),
926
  CONSTRAINT `fk_specimen_taxon_occurrence10` FOREIGN KEY (`id`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
927
  CONSTRAINT `specimen_observation_id_fkey1` FOREIGN KEY (`current_collection`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
928
  CONSTRAINT `specimen_observation_id_fkey2` FOREIGN KEY (`owner_collection`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
929
  CONSTRAINT `fk_specimen_observation_specimen1` FOREIGN KEY (`subject`) REFERENCES `specimen` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
930
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
931
/*!40101 SET character_set_client = @saved_cs_client */;
932

    
933
--
934
-- Dumping data for table `specimen_observation`
935
--
936

    
937
/*!40000 ALTER TABLE `specimen_observation` DISABLE KEYS */;
938
/*!40000 ALTER TABLE `specimen_observation` ENABLE KEYS */;
939

    
940
--
941
-- Table structure for table `stem`
942
--
943

    
944
/*!40101 SET @saved_cs_client     = @@character_set_client */;
945
/*!40101 SET character_set_client = utf8 */;
946
CREATE TABLE `stem` (
947
  `id` varbinary(767) NOT NULL,
948
  `individual` varbinary(767) DEFAULT NULL,
949
  PRIMARY KEY (`id`),
950
  KEY `fk_stem_individual1_idx` (`individual`),
951
  CONSTRAINT `fk_stem_individual1` FOREIGN KEY (`individual`) REFERENCES `individual` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
952
  CONSTRAINT `fk_stem_individual2` FOREIGN KEY (`id`) REFERENCES `individual` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
953
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='An "individual tree stem" ("VegBank":http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=stemlocation&entity=dba_tabledescription&where=where_tablename)';
954
/*!40101 SET character_set_client = @saved_cs_client */;
955

    
956
--
957
-- Dumping data for table `stem`
958
--
959

    
960
/*!40000 ALTER TABLE `stem` DISABLE KEYS */;
961
/*!40000 ALTER TABLE `stem` ENABLE KEYS */;
962

    
963
--
964
-- Table structure for table `stem_observation`
965
--
966

    
967
/*!40101 SET @saved_cs_client     = @@character_set_client */;
968
/*!40101 SET character_set_client = utf8 */;
969
CREATE TABLE `stem_observation` (
970
  `id` varbinary(767) NOT NULL,
971
  `subject` varbinary(767) DEFAULT NULL,
972
  `individual_observation` varbinary(767) DEFAULT NULL,
973
  PRIMARY KEY (`id`),
974
  UNIQUE KEY `stem_observation_unique` (`individual_observation`,`subject`),
975
  KEY `fk_stem_observation_individual_observation1_idx` (`individual_observation`),
976
  KEY `fk_stem_observation_stem1_idx` (`subject`),
977
  CONSTRAINT `fk_stem_observation_stem1` FOREIGN KEY (`subject`) REFERENCES `stem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
978
  CONSTRAINT `fk_stem_observation_individual_observation1` FOREIGN KEY (`individual_observation`) REFERENCES `individual_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
979
  CONSTRAINT `fk_stem_observation_individual_observation2` FOREIGN KEY (`id`) REFERENCES `individual_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
980
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='An observation of a [[VegCore#Stem|Stem]]';
981
/*!40101 SET character_set_client = @saved_cs_client */;
982

    
983
--
984
-- Dumping data for table `stem_observation`
985
--
986

    
987
/*!40000 ALTER TABLE `stem_observation` DISABLE KEYS */;
988
/*!40000 ALTER TABLE `stem_observation` ENABLE KEYS */;
989

    
990
--
991
-- Table structure for table `stratum`
992
--
993

    
994
/*!40101 SET @saved_cs_client     = @@character_set_client */;
995
/*!40101 SET character_set_client = utf8 */;
996
CREATE TABLE `stratum` (
997
  `id` varbinary(767) NOT NULL,
998
  `name` varbinary(767) NOT NULL,
999
  `height_min_m` varbinary(767) DEFAULT NULL,
1000
  `height_max_m` varbinary(767) DEFAULT NULL,
1001
  PRIMARY KEY (`id`),
1002
  CONSTRAINT `fk_layer_stratum1` FOREIGN KEY (`id`) REFERENCES `method` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1003
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='= VegBank.vegpath.org?stratumType';
1004
/*!40101 SET character_set_client = @saved_cs_client */;
1005

    
1006
--
1007
-- Dumping data for table `stratum`
1008
--
1009

    
1010
/*!40000 ALTER TABLE `stratum` DISABLE KEYS */;
1011
/*!40000 ALTER TABLE `stratum` ENABLE KEYS */;
1012

    
1013
--
1014
-- Table structure for table `subplace`
1015
--
1016

    
1017
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1018
/*!40101 SET character_set_client = utf8 */;
1019
CREATE TABLE `subplace` (
1020
  `id` varbinary(767) NOT NULL,
1021
  `parent` varbinary(767) NOT NULL,
1022
  `x_m` double DEFAULT NULL,
1023
  `y_m` double DEFAULT NULL,
1024
  `coords` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1025
  PRIMARY KEY (`id`),
1026
  KEY `fk_rel_place_place1_idx` (`parent`),
1027
  CONSTRAINT `fk_subplot_place2` FOREIGN KEY (`id`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1028
  CONSTRAINT `fk_rel_place_place1` FOREIGN KEY (`parent`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1029
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='stores plot elements such as subplots ("subplot, line, or any other subsample  or subdivision of plot" ("SALVIAS":http://salvias.net/Documents/salvias_data_dictionary.html#Plot_data/subplot))';
1030
/*!40101 SET character_set_client = @saved_cs_client */;
1031

    
1032
--
1033
-- Dumping data for table `subplace`
1034
--
1035

    
1036
/*!40000 ALTER TABLE `subplace` DISABLE KEYS */;
1037
/*!40000 ALTER TABLE `subplace` ENABLE KEYS */;
1038

    
1039
--
1040
-- Table structure for table `subplot`
1041
--
1042

    
1043
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1044
/*!40101 SET character_set_client = utf8 */;
1045
CREATE TABLE `subplot` (
1046
  `id` varbinary(767) NOT NULL,
1047
  `parent` varbinary(767) NOT NULL COMMENT 'the parent plot',
1048
  PRIMARY KEY (`id`),
1049
  KEY `fk_subplot_plot2_idx` (`parent`),
1050
  CONSTRAINT `fk_subplot_plot1` FOREIGN KEY (`id`) REFERENCES `plot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1051
  CONSTRAINT `fk_subplot_plot2` FOREIGN KEY (`parent`) REFERENCES `plot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1052
  CONSTRAINT `fk_subplot_rel_place1` FOREIGN KEY (`id`) REFERENCES `subplace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1053
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
1054
/*!40101 SET character_set_client = @saved_cs_client */;
1055

    
1056
--
1057
-- Dumping data for table `subplot`
1058
--
1059

    
1060
/*!40000 ALTER TABLE `subplot` DISABLE KEYS */;
1061
/*!40000 ALTER TABLE `subplot` ENABLE KEYS */;
1062

    
1063
--
1064
-- Table structure for table `taxa_sampling_event`
1065
--
1066

    
1067
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1068
/*!40101 SET character_set_client = utf8 */;
1069
CREATE TABLE `taxa_sampling_event` (
1070
  `id` varbinary(767) NOT NULL,
1071
  `parent` varbinary(767) DEFAULT NULL COMMENT 'the taxa_sampling_event for the parent stratum',
1072
  `place_visit` varbinary(767) NOT NULL,
1073
  `subsetting_method` varbinary(767) DEFAULT NULL,
1074
  PRIMARY KEY (`id`),
1075
  UNIQUE KEY `taxa_sampling_event__unique` (`place_visit`,`subsetting_method`),
1076
  KEY `fk_sampling_event_method1_idx` (`subsetting_method`),
1077
  KEY `taxa_sampling_event_id_fkey1_idx` (`place_visit`),
1078
  KEY `taxa_sampling_event_id_fkey2_idx` (`parent`),
1079
  CONSTRAINT `fk_project_event10` FOREIGN KEY (`id`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1080
  CONSTRAINT `taxa_sampling_event_id_fkey2` FOREIGN KEY (`parent`) REFERENCES `taxa_sampling_event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1081
  CONSTRAINT `fk_sampling_event_method1` FOREIGN KEY (`subsetting_method`) REFERENCES `method` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1082
  CONSTRAINT `taxa_sampling_event_id_fkey1` FOREIGN KEY (`place_visit`) REFERENCES `place_visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1083
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='= VegX.vegpath.org?stratumObservation, VegBank.vegpath.org?stratum (which was confusingly named)';
1084
/*!40101 SET character_set_client = @saved_cs_client */;
1085

    
1086
--
1087
-- Dumping data for table `taxa_sampling_event`
1088
--
1089

    
1090
/*!40000 ALTER TABLE `taxa_sampling_event` DISABLE KEYS */;
1091
/*!40000 ALTER TABLE `taxa_sampling_event` ENABLE KEYS */;
1092

    
1093
--
1094
-- Table structure for table `taxon_absence`
1095
--
1096

    
1097
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1098
/*!40101 SET character_set_client = utf8 */;
1099
CREATE TABLE `taxon_absence` (
1100
  `id` varbinary(767) NOT NULL,
1101
  PRIMARY KEY (`id`),
1102
  CONSTRAINT `fk_taxon_absence_taxa_sampling_event1` FOREIGN KEY (`id`) REFERENCES `aggregate_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1103
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='An observation that a [[VegCore#Taxon|Taxon]]''s does _not_ exist in a place';
1104
/*!40101 SET character_set_client = @saved_cs_client */;
1105

    
1106
--
1107
-- Dumping data for table `taxon_absence`
1108
--
1109

    
1110
/*!40000 ALTER TABLE `taxon_absence` DISABLE KEYS */;
1111
/*!40000 ALTER TABLE `taxon_absence` ENABLE KEYS */;
1112

    
1113
--
1114
-- Table structure for table `taxon_assertion`
1115
--
1116

    
1117
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1118
/*!40101 SET character_set_client = utf8 */;
1119
CREATE TABLE `taxon_assertion` (
1120
  `id` varbinary(767) NOT NULL,
1121
  `string` varbinary(767) NOT NULL COMMENT 'for parsed_taxon_assertion, this is the TNRS input name, not the concatenated matched name',
1122
  `taxon` varbinary(767) DEFAULT NULL,
1123
  `cf_aff` varbinary(767) DEFAULT NULL,
1124
  `annotations` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1125
  PRIMARY KEY (`id`),
1126
  KEY `fk_taxon_assertion_taxon_string1_idx` (`string`),
1127
  KEY `fk_taxon_assertion_taxon_name1_idx` (`taxon`),
1128
  CONSTRAINT `fk_qualified_taxon_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1129
  CONSTRAINT `fk_taxon_assertion_taxon_string1` FOREIGN KEY (`string`) REFERENCES `taxon_string` (`string`) ON DELETE CASCADE ON UPDATE CASCADE,
1130
  CONSTRAINT `fk_taxon_assertion_taxon_name1` FOREIGN KEY (`taxon`) REFERENCES `taxon_name` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1131
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
1132
/*!40101 SET character_set_client = @saved_cs_client */;
1133

    
1134
--
1135
-- Dumping data for table `taxon_assertion`
1136
--
1137

    
1138
/*!40000 ALTER TABLE `taxon_assertion` DISABLE KEYS */;
1139
/*!40000 ALTER TABLE `taxon_assertion` ENABLE KEYS */;
1140

    
1141
--
1142
-- Table structure for table `taxon_concept`
1143
--
1144

    
1145
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1146
/*!40101 SET character_set_client = utf8 */;
1147
CREATE TABLE `taxon_concept` (
1148
  `id` varbinary(767) NOT NULL,
1149
  `according_to` varbinary(767) NOT NULL,
1150
  `parent` varbinary(767) DEFAULT NULL,
1151
  `accepted_taxon_concept` varbinary(767) DEFAULT NULL,
1152
  PRIMARY KEY (`id`),
1153
  UNIQUE KEY `taxon_concept_unique_name` (`according_to`),
1154
  KEY `fk_taxon_taxon1_idx` (`parent`),
1155
  KEY `fk_taxon_concept_source1_idx` (`according_to`),
1156
  KEY `fk_taxon_concept_taxon_concept1_idx` (`accepted_taxon_concept`),
1157
  CONSTRAINT `fk_taxon_taxon1` FOREIGN KEY (`parent`) REFERENCES `taxon_concept` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1158
  CONSTRAINT `fk_taxon_concept_source1` FOREIGN KEY (`according_to`) REFERENCES `dataset` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1159
  CONSTRAINT `fk_taxon_concept_taxon_concept1` FOREIGN KEY (`accepted_taxon_concept`) REFERENCES `taxon_concept` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1160
  CONSTRAINT `fk_taxon_concept_taxon_name1` FOREIGN KEY (`id`) REFERENCES `taxon_name` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1161
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='A [[VegCore#Taxon|Taxon]] described by a specific [[VegCore#Reference|Reference]]';
1162
/*!40101 SET character_set_client = @saved_cs_client */;
1163

    
1164
--
1165
-- Dumping data for table `taxon_concept`
1166
--
1167

    
1168
/*!40000 ALTER TABLE `taxon_concept` DISABLE KEYS */;
1169
/*!40000 ALTER TABLE `taxon_concept` ENABLE KEYS */;
1170

    
1171
--
1172
-- Table structure for table `taxon_determination`
1173
--
1174

    
1175
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1176
/*!40101 SET character_set_client = utf8 */;
1177
CREATE TABLE `taxon_determination` (
1178
  `id` varbinary(767) NOT NULL,
1179
  `taxon_assertion` varbinary(767) NOT NULL,
1180
  `voucher` varbinary(767) DEFAULT NULL,
1181
  `identified_by` varbinary(767) DEFAULT NULL,
1182
  `fit_info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1183
  PRIMARY KEY (`id`),
1184
  UNIQUE KEY `taxon_determination_unique` (`taxon_assertion`,`identified_by`),
1185
  KEY `fk_taxon_occurrence_has_qualified_taxon1_idx` (`taxon_assertion`),
1186
  KEY `fk_taxon_determination_party_list1_idx` (`identified_by`),
1187
  KEY `taxon_determination_id_fkey1_idx` (`voucher`),
1188
  CONSTRAINT `fk_taxon_occurrence_has_qualified_taxon1` FOREIGN KEY (`taxon_assertion`) REFERENCES `taxon_assertion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1189
  CONSTRAINT `taxon_determination_id_fkey1` FOREIGN KEY (`voucher`) REFERENCES `reobservable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1190
  CONSTRAINT `fk_taxon_determination_party_list1` FOREIGN KEY (`identified_by`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1191
  CONSTRAINT `fk_taxon_determination_taxon_observation1` FOREIGN KEY (`id`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1192
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='An assertion that a [[VegCore#TaxonOccurrence|TaxonOccurrence]] is a particular [[VegCore#Taxon|Taxon]]';
1193
/*!40101 SET character_set_client = @saved_cs_client */;
1194

    
1195
--
1196
-- Dumping data for table `taxon_determination`
1197
--
1198

    
1199
/*!40000 ALTER TABLE `taxon_determination` DISABLE KEYS */;
1200
/*!40000 ALTER TABLE `taxon_determination` ENABLE KEYS */;
1201

    
1202
--
1203
-- Table structure for table `taxon_name`
1204
--
1205

    
1206
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1207
/*!40101 SET character_set_client = utf8 */;
1208
CREATE TABLE `taxon_name` (
1209
  `id` varbinary(767) NOT NULL,
1210
  `unique_name` varbinary(767) NOT NULL,
1211
  `formal_name` varbinary(767) DEFAULT NULL,
1212
  `taxon_name` varbinary(767) DEFAULT NULL,
1213
  `author` varbinary(767) DEFAULT NULL,
1214
  `common_name` varbinary(767) DEFAULT NULL,
1215
  `rank` varbinary(767) DEFAULT NULL,
1216
  `taxon_path` varbinary(767) DEFAULT NULL,
1217
  PRIMARY KEY (`id`),
1218
  KEY `fk_taxon_concept_taxon_string10_idx` (`unique_name`),
1219
  KEY `fk_taxon_name_taxon_path1_idx` (`taxon_path`),
1220
  CONSTRAINT `fk_taxon_record10` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1221
  CONSTRAINT `fk_taxon_concept_taxon_string10` FOREIGN KEY (`unique_name`) REFERENCES `taxon_string` (`string`) ON DELETE CASCADE ON UPDATE CASCADE,
1222
  CONSTRAINT `fk_taxon_name_taxon_path1` FOREIGN KEY (`taxon_path`) REFERENCES `taxon_path` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1223
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
1224
/*!40101 SET character_set_client = @saved_cs_client */;
1225

    
1226
--
1227
-- Dumping data for table `taxon_name`
1228
--
1229

    
1230
/*!40000 ALTER TABLE `taxon_name` DISABLE KEYS */;
1231
/*!40000 ALTER TABLE `taxon_name` ENABLE KEYS */;
1232

    
1233
--
1234
-- Table structure for table `taxon_observation`
1235
--
1236

    
1237
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1238
/*!40101 SET character_set_client = utf8 */;
1239
CREATE TABLE `taxon_observation` (
1240
  `id` varbinary(767) NOT NULL,
1241
  `parent` varbinary(767) DEFAULT NULL COMMENT 'the observation of the same taxon_occurrence in the parent sampling_event',
1242
  `subject` varbinary(767) DEFAULT NULL,
1243
  `taxon_occurrence` varbinary(767) NOT NULL COMMENT 'when not provided (and not fillable from another field), a taxon_occurrence will be created with the same id as the taxon_observation',
1244
  `sampling_event` varbinary(767) NOT NULL COMMENT 'for specimens, this will have the same event information (date_range, participants, place) as the taxon_observation',
1245
  `primary_collector` varbinary(767) DEFAULT NULL,
1246
  `collector_number` varbinary(767) DEFAULT NULL,
1247
  `all_collectors` varbinary(767) DEFAULT NULL,
1248
  `growth_form` varbinary(767) DEFAULT NULL,
1249
  `cultivated` tinyint(1) DEFAULT NULL,
1250
  `traits` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1251
  PRIMARY KEY (`id`),
1252
  KEY `fk_taxon_observation_taxon_occurrence1_idx` (`taxon_occurrence`),
1253
  KEY `fk_taxon_observation_taxa_sampling_event1_idx` (`sampling_event`),
1254
  KEY `taxon_observation_id_fkey1_idx` (`primary_collector`),
1255
  KEY `fk_taxon_observation_party_list1_idx` (`all_collectors`),
1256
  KEY `taxon_observation__unique` (`sampling_event`,`primary_collector`,`collector_number`),
1257
  KEY `taxon_observation_id_fkey2_idx` (`parent`),
1258
  KEY `taxon_observation_id_fkey3_idx` (`subject`),
1259
  CONSTRAINT `taxon_observation_id_fkey2` FOREIGN KEY (`parent`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1260
  CONSTRAINT `fk_taxon_observation_party_list1` FOREIGN KEY (`all_collectors`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1261
  CONSTRAINT `fk_taxon_observation_sampling_event1` FOREIGN KEY (`id`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1262
  CONSTRAINT `fk_taxon_observation_taxa_sampling_event1` FOREIGN KEY (`sampling_event`) REFERENCES `taxa_sampling_event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1263
  CONSTRAINT `fk_taxon_observation_taxon_occurrence1` FOREIGN KEY (`taxon_occurrence`) REFERENCES `taxon_occurrence` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1264
  CONSTRAINT `taxon_observation_id_fkey1` FOREIGN KEY (`primary_collector`) REFERENCES `party` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1265
  CONSTRAINT `taxon_observation_id_fkey3` FOREIGN KEY (`subject`) REFERENCES `taxon_occurrence` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1266
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='= DwC.vegpath.org?Occurrence (which actually represents an *observation* of an occurrence)';
1267
/*!40101 SET character_set_client = @saved_cs_client */;
1268

    
1269
--
1270
-- Dumping data for table `taxon_observation`
1271
--
1272

    
1273
/*!40000 ALTER TABLE `taxon_observation` DISABLE KEYS */;
1274
/*!40000 ALTER TABLE `taxon_observation` ENABLE KEYS */;
1275

    
1276
--
1277
-- Table structure for table `taxon_occurrence`
1278
--
1279

    
1280
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1281
/*!40101 SET character_set_client = utf8 */;
1282
CREATE TABLE `taxon_occurrence` (
1283
  `id` varbinary(767) NOT NULL,
1284
  `within_place` varbinary(767) NOT NULL,
1285
  `current_observation` varbinary(767) DEFAULT NULL,
1286
  PRIMARY KEY (`id`),
1287
  KEY `fk_taxon_occurrence_taxon_determination3_idx` (`current_observation`),
1288
  KEY `fk_taxon_occurrence_place1_idx` (`within_place`),
1289
  CONSTRAINT `fk_taxon_occurrence_taxon_determination3` FOREIGN KEY (`current_observation`) REFERENCES `taxon_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1290
  CONSTRAINT `fk_taxon_occurrence_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1291
  CONSTRAINT `fk_taxon_occurrence_place1` FOREIGN KEY (`within_place`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1292
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='*not* DwC.vegpath.org?Occurrence';
1293
/*!40101 SET character_set_client = @saved_cs_client */;
1294

    
1295
--
1296
-- Dumping data for table `taxon_occurrence`
1297
--
1298

    
1299
/*!40000 ALTER TABLE `taxon_occurrence` DISABLE KEYS */;
1300
/*!40000 ALTER TABLE `taxon_occurrence` ENABLE KEYS */;
1301

    
1302
--
1303
-- Table structure for table `taxon_path`
1304
--
1305

    
1306
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1307
/*!40101 SET character_set_client = utf8 */;
1308
CREATE TABLE `taxon_path` (
1309
  `id` varbinary(767) NOT NULL,
1310
  `family` varbinary(767) DEFAULT NULL,
1311
  `genus` varbinary(767) DEFAULT NULL,
1312
  `specific_epithet` varbinary(767) DEFAULT NULL,
1313
  `ranks` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1314
  PRIMARY KEY (`id`)
1315
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='"a group of one (or more) populations of organism(s), which a taxonomist adjudges to be a unit" ("Wikipedia":http://en.wikipedia.org/wiki/Taxon)';
1316
/*!40101 SET character_set_client = @saved_cs_client */;
1317

    
1318
--
1319
-- Dumping data for table `taxon_path`
1320
--
1321

    
1322
/*!40000 ALTER TABLE `taxon_path` DISABLE KEYS */;
1323
/*!40000 ALTER TABLE `taxon_path` ENABLE KEYS */;
1324

    
1325
--
1326
-- Table structure for table `taxon_presence`
1327
--
1328

    
1329
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1330
/*!40101 SET character_set_client = utf8 */;
1331
CREATE TABLE `taxon_presence` (
1332
  `id` varbinary(767) NOT NULL,
1333
  `cover_percent` double DEFAULT NULL,
1334
  PRIMARY KEY (`id`),
1335
  CONSTRAINT `fk_taxon_presence_taxon_determination1` FOREIGN KEY (`id`) REFERENCES `aggregate_observation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1336
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='= VegX.vegpath.org?aggregateOrganismObservation, VegBank.vegpath.org?taxonImportance; "An observation applying to all occurrences of an organism" ("VegX":http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#/aggregateOrganismObservations/aggregateOrganismObservation).';
1337
/*!40101 SET character_set_client = @saved_cs_client */;
1338

    
1339
--
1340
-- Dumping data for table `taxon_presence`
1341
--
1342

    
1343
/*!40000 ALTER TABLE `taxon_presence` DISABLE KEYS */;
1344
/*!40000 ALTER TABLE `taxon_presence` ENABLE KEYS */;
1345

    
1346
--
1347
-- Table structure for table `taxon_scrub`
1348
--
1349

    
1350
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1351
/*!40101 SET character_set_client = utf8 */;
1352
CREATE TABLE `taxon_scrub` (
1353
  `id` varbinary(767) NOT NULL,
1354
  `input_string` varbinary(767) NOT NULL,
1355
  `parsed_taxon_assertion` varbinary(767) NOT NULL,
1356
  `matched_taxon_concept` varbinary(767) DEFAULT NULL,
1357
  `match_score` float DEFAULT NULL,
1358
  `match_info` set('hstore') COLLATE utf8_bin DEFAULT NULL,
1359
  PRIMARY KEY (`id`),
1360
  KEY `fk_parsed_taxon_assertion_taxon_name1_idx` (`matched_taxon_concept`),
1361
  KEY `fk_taxon_scrub_taxon_assertion1_idx` (`parsed_taxon_assertion`),
1362
  KEY `fk_taxon_scrub_taxon_string1_idx` (`input_string`),
1363
  CONSTRAINT `fk_parsed_taxon_assertion_taxon_name1` FOREIGN KEY (`matched_taxon_concept`) REFERENCES `taxon_concept` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1364
  CONSTRAINT `fk_taxon_scrub_taxon_assertion1` FOREIGN KEY (`parsed_taxon_assertion`) REFERENCES `taxon_assertion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1365
  CONSTRAINT `fk_taxon_scrub_taxon_string1` FOREIGN KEY (`input_string`) REFERENCES `taxon_string` (`string`) ON DELETE CASCADE ON UPDATE CASCADE,
1366
  CONSTRAINT `fk_taxon_scrub_record1` FOREIGN KEY (`id`) REFERENCES `traceable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1367
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
1368
/*!40101 SET character_set_client = @saved_cs_client */;
1369

    
1370
--
1371
-- Dumping data for table `taxon_scrub`
1372
--
1373

    
1374
/*!40000 ALTER TABLE `taxon_scrub` DISABLE KEYS */;
1375
/*!40000 ALTER TABLE `taxon_scrub` ENABLE KEYS */;
1376

    
1377
--
1378
-- Table structure for table `taxon_string`
1379
--
1380

    
1381
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1382
/*!40101 SET character_set_client = utf8 */;
1383
CREATE TABLE `taxon_string` (
1384
  `string` varbinary(767) NOT NULL,
1385
  PRIMARY KEY (`string`)
1386
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='to get the parsed_taxon_assertion (TNRS result) for a taxon_string, join using taxon_string.string<-taxon_assertion(string)::parsed_taxon_assertion[source=''TNRS.version''] (see wiki.vegpath.org/SQL_dotpaths)';
1387
/*!40101 SET character_set_client = @saved_cs_client */;
1388

    
1389
--
1390
-- Dumping data for table `taxon_string`
1391
--
1392

    
1393
/*!40000 ALTER TABLE `taxon_string` DISABLE KEYS */;
1394
/*!40000 ALTER TABLE `taxon_string` ENABLE KEYS */;
1395

    
1396
--
1397
-- Table structure for table `traceable`
1398
--
1399

    
1400
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1401
/*!40101 SET character_set_client = utf8 */;
1402
CREATE TABLE `traceable` (
1403
  `id` varbinary(767) NOT NULL,
1404
  `id_by_source` varbinary(767) DEFAULT NULL COMMENT 'allows referencing a traceable by its source information even when the subclass chose a different value for the pkey',
1405
  `source` varbinary(767) NOT NULL,
1406
  `id_within_source` varbinary(767) DEFAULT NULL COMMENT 'the portion of the source that this traceable refers to. when specified, this must *uniquely identify* the traceable within the source. denormalized source data often contains data for many VegCore tables in the same row, and the traceables for each of these table entries must be distinguished *from each other* since they share the same source. this is usually just the VegCore table name, sometimes with a distinguishing prefix (e.g. collector.party/identified_by.party; current_observation.taxon_determination/orig_observation.taxon_determination). this can also identify e.g. a dataset within the source that it came from.',
1407
  `authors` varbinary(767) DEFAULT NULL COMMENT 'the people who created the information in the data record. this is *different* from dataset.data_owners, and refers *only* to original data creators such as collectors and identifiers. note that in vegetation data, these record-specific authors generally do not receive attribution. this makes traceable mutually recursive with party_list. = Brad.vegpath.org?attribution.data_author',
1408
  PRIMARY KEY (`id`),
1409
  UNIQUE KEY `traceable_unique` (`source`,`id_within_source`),
1410
  UNIQUE KEY `traceable__id_by_source` (`id_by_source`),
1411
  KEY `traceable_id_fkey1_idx` (`authors`),
1412
  CONSTRAINT `traceable_id_fkey1` FOREIGN KEY (`authors`) REFERENCES `party_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1413
  CONSTRAINT `fk_record_source1` FOREIGN KEY (`source`) REFERENCES `source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1414
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='a row that can have associated source information';
1415
/*!40101 SET character_set_client = @saved_cs_client */;
1416

    
1417
--
1418
-- Dumping data for table `traceable`
1419
--
1420

    
1421
/*!40000 ALTER TABLE `traceable` DISABLE KEYS */;
1422
/*!40000 ALTER TABLE `traceable` ENABLE KEYS */;
1423
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
1424

    
1425
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
1426
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
1427
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
1428
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
1429
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
1430
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
1431
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
1432

    
1433
-- Dump completed
(4-4/8)