1 |
537
|
aaronmk
|
-- Existing tables
|
2 |
|
|
|
3 |
596
|
aaronmk
|
CREATE TABLE role
|
4 |
537
|
aaronmk
|
(
|
5 |
|
|
role_id int(11) NOT NULL AUTO_INCREMENT,
|
6 |
|
|
rolecode character varying(30) NOT NULL,
|
7 |
|
|
roledescription character varying(200),
|
8 |
596
|
aaronmk
|
CONSTRAINT role_pkey PRIMARY KEY (role_id )
|
9 |
537
|
aaronmk
|
);
|
10 |
|
|
|
11 |
|
|
CREATE TABLE reference
|
12 |
|
|
(
|
13 |
|
|
reference_id int(11) NOT NULL AUTO_INCREMENT,
|
14 |
|
|
shortname character varying(250),
|
15 |
|
|
fulltext__ text,
|
16 |
|
|
referencetype character varying(250)
|
17 |
|
|
);
|
18 |
|
|
|
19 |
|
|
CREATE TABLE party
|
20 |
|
|
(
|
21 |
|
|
party_id int(11) NOT NULL AUTO_INCREMENT,
|
22 |
|
|
salutation character varying(20),
|
23 |
|
|
givenname character varying(50),
|
24 |
|
|
middlename character varying(50),
|
25 |
|
|
surname character varying(50),
|
26 |
|
|
organizationname character varying(100)
|
27 |
|
|
);
|
28 |
|
|
|
29 |
|
|
CREATE TABLE plantname
|
30 |
|
|
(
|
31 |
|
|
plantname_id int(11) NOT NULL AUTO_INCREMENT,
|
32 |
|
|
plantname character varying(255) NOT NULL,
|
33 |
|
|
reference_id int(11),
|
34 |
599
|
aaronmk
|
dateentered timestamp NULL DEFAULT now(),
|
35 |
537
|
aaronmk
|
CONSTRAINT plantname_pkey PRIMARY KEY (plantname_id ),
|
36 |
|
|
CONSTRAINT plantname_reference_id FOREIGN KEY (reference_id)
|
37 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
38 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
39 |
|
|
);
|
40 |
|
|
|
41 |
|
|
CREATE TABLE plantconcept
|
42 |
|
|
(
|
43 |
|
|
plantconcept_id int(11) NOT NULL AUTO_INCREMENT,
|
44 |
|
|
plantname_id int(11) NOT NULL,
|
45 |
599
|
aaronmk
|
reference_id int(11),
|
46 |
537
|
aaronmk
|
plantcode character varying(23),
|
47 |
|
|
plantdescription text,
|
48 |
|
|
d_obscount int(11),
|
49 |
|
|
d_currentaccepted int(1),
|
50 |
|
|
accessioncode character varying(255),
|
51 |
|
|
CONSTRAINT plantconcept_pkey PRIMARY KEY (plantconcept_id ),
|
52 |
|
|
CONSTRAINT plantconcept_plantname_id FOREIGN KEY (plantname_id)
|
53 |
|
|
REFERENCES plantname (plantname_id) MATCH SIMPLE
|
54 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
55 |
|
|
CONSTRAINT plantconcept_reference_id FOREIGN KEY (reference_id)
|
56 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
57 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
58 |
|
|
);
|
59 |
|
|
|
60 |
592
|
aaronmk
|
CREATE TABLE stratummethod
|
61 |
|
|
(
|
62 |
|
|
stratummethod_id int(11) NOT NULL AUTO_INCREMENT,
|
63 |
|
|
reference_id int(11),
|
64 |
|
|
stratummethodname character varying(30) NOT NULL,
|
65 |
|
|
stratummethoddescription text,
|
66 |
|
|
stratumassignment character varying(50),
|
67 |
|
|
accessioncode character varying(255),
|
68 |
|
|
CONSTRAINT stratummethod_pkey PRIMARY KEY (stratummethod_id ),
|
69 |
|
|
CONSTRAINT stratummethod_reference_id FOREIGN KEY (reference_id)
|
70 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
71 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
72 |
|
|
);
|
73 |
|
|
|
74 |
|
|
CREATE TABLE stratumtype
|
75 |
|
|
(
|
76 |
|
|
stratumtype_id int(11) NOT NULL AUTO_INCREMENT,
|
77 |
|
|
stratummethod_id int(11) NOT NULL,
|
78 |
|
|
stratumindex character varying(10),
|
79 |
|
|
stratumname character varying(30),
|
80 |
|
|
stratumdescription text,
|
81 |
|
|
CONSTRAINT stratumtype_pkey PRIMARY KEY (stratumtype_id ),
|
82 |
|
|
CONSTRAINT stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id)
|
83 |
|
|
REFERENCES stratummethod (stratummethod_id) MATCH SIMPLE
|
84 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
85 |
|
|
);
|
86 |
|
|
|
87 |
537
|
aaronmk
|
CREATE TABLE namedplace
|
88 |
|
|
(
|
89 |
|
|
namedplace_id int(11) NOT NULL AUTO_INCREMENT,
|
90 |
|
|
placesystem character varying(50),
|
91 |
|
|
placename character varying(100) NOT NULL,
|
92 |
|
|
placedescription text,
|
93 |
|
|
placecode character varying(15),
|
94 |
|
|
owner character varying(100),
|
95 |
|
|
reference_id int(11),
|
96 |
|
|
d_obscount int(11),
|
97 |
|
|
accessioncode character varying(255),
|
98 |
|
|
CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id ),
|
99 |
|
|
CONSTRAINT namedplace_reference_id FOREIGN KEY (reference_id)
|
100 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
101 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
102 |
|
|
CONSTRAINT namedplace_keys UNIQUE (placesystem , placename )
|
103 |
|
|
);
|
104 |
|
|
|
105 |
566
|
aaronmk
|
CREATE TABLE locationplace
|
106 |
552
|
aaronmk
|
(
|
107 |
|
|
locationplace_id int(11) NOT NULL AUTO_INCREMENT,
|
108 |
|
|
location_id int(11) NOT NULL,
|
109 |
|
|
calculated int(1),
|
110 |
|
|
namedplace_id int(11) NOT NULL,
|
111 |
566
|
aaronmk
|
CONSTRAINT locationplace_pkey PRIMARY KEY (locationplace_id ),
|
112 |
|
|
CONSTRAINT locationplace_location_id FOREIGN KEY (location_id)
|
113 |
552
|
aaronmk
|
REFERENCES location (location_id) MATCH SIMPLE
|
114 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
115 |
566
|
aaronmk
|
CONSTRAINT locationplace_namedplace_id FOREIGN KEY (namedplace_id)
|
116 |
552
|
aaronmk
|
REFERENCES namedplace (namedplace_id) MATCH SIMPLE
|
117 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
118 |
566
|
aaronmk
|
CONSTRAINT locationplace_keys UNIQUE (location_id , namedplace_id )
|
119 |
552
|
aaronmk
|
);
|
120 |
|
|
|
121 |
537
|
aaronmk
|
CREATE TABLE project
|
122 |
|
|
(
|
123 |
|
|
project_id int(11) NOT NULL AUTO_INCREMENT,
|
124 |
|
|
projectname character varying(150) NOT NULL,
|
125 |
|
|
projectdescription text,
|
126 |
578
|
aaronmk
|
startdate timestamp NULL,
|
127 |
|
|
stopdate timestamp NULL,
|
128 |
537
|
aaronmk
|
d_obscount int(11),
|
129 |
578
|
aaronmk
|
d_lastlocationaddeddate timestamp NULL,
|
130 |
537
|
aaronmk
|
accessioncode character varying(255),
|
131 |
|
|
CONSTRAINT project_pkey PRIMARY KEY (project_id ),
|
132 |
|
|
CONSTRAINT project_keys UNIQUE (projectname , startdate , stopdate )
|
133 |
|
|
);
|
134 |
|
|
|
135 |
|
|
-- New tables
|
136 |
|
|
|
137 |
536
|
aaronmk
|
CREATE TABLE location
|
138 |
|
|
(
|
139 |
|
|
location_id int(11) NOT NULL AUTO_INCREMENT,
|
140 |
582
|
aaronmk
|
authorlocationcode character varying(30),
|
141 |
536
|
aaronmk
|
reference_id int(11),
|
142 |
|
|
parent_id int(11),
|
143 |
582
|
aaronmk
|
reallatitude double precision,
|
144 |
|
|
reallongitude double precision,
|
145 |
536
|
aaronmk
|
locationaccuracy double precision,
|
146 |
575
|
aaronmk
|
confidentialitystatus int(11) NOT NULL DEFAULT 0,
|
147 |
536
|
aaronmk
|
confidentialityreason character varying(200),
|
148 |
580
|
aaronmk
|
publiclatitude double precision,
|
149 |
|
|
publiclongitude double precision,
|
150 |
561
|
aaronmk
|
`... (truncated) ...` int(11),
|
151 |
536
|
aaronmk
|
accessioncode character varying(255),
|
152 |
|
|
sublocationxposition double precision,
|
153 |
|
|
sublocationyposition double precision,
|
154 |
|
|
namedplace_id int(11),
|
155 |
|
|
CONSTRAINT location_pkey PRIMARY KEY (location_id ),
|
156 |
|
|
CONSTRAINT location_namedplace_id FOREIGN KEY (namedplace_id)
|
157 |
|
|
REFERENCES namedplace (namedplace_id) MATCH SIMPLE
|
158 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
159 |
|
|
CONSTRAINT location_parent_id FOREIGN KEY (parent_id)
|
160 |
|
|
REFERENCES location (location_id) MATCH SIMPLE
|
161 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
162 |
|
|
CONSTRAINT location_reference_id FOREIGN KEY (reference_id)
|
163 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
164 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
165 |
582
|
aaronmk
|
CONSTRAINT location_keys_code UNIQUE (reference_id , authorlocationcode ),
|
166 |
|
|
CONSTRAINT location_keys_coords UNIQUE (reference_id , reallatitude , reallongitude ),
|
167 |
|
|
CONSTRAINT location_keys_subplot_code UNIQUE (parent_id , authorlocationcode ),
|
168 |
|
|
CONSTRAINT location_keys_subplot_coords UNIQUE (parent_id , sublocationxposition , sublocationyposition )
|
169 |
536
|
aaronmk
|
);
|
170 |
|
|
|
171 |
|
|
CREATE TABLE locationevent -- VegBank's observation table.
|
172 |
|
|
(
|
173 |
|
|
locationevent_id int(11) NOT NULL AUTO_INCREMENT,
|
174 |
|
|
previous_id int(11),
|
175 |
605
|
aaronmk
|
location_id int(11),
|
176 |
536
|
aaronmk
|
project_id int(11),
|
177 |
570
|
aaronmk
|
authoreventcode character varying(30),
|
178 |
561
|
aaronmk
|
`... (truncated) ...` int(11),
|
179 |
536
|
aaronmk
|
accessioncode character varying(255),
|
180 |
586
|
aaronmk
|
sourceaccessioncode character varying(100),
|
181 |
536
|
aaronmk
|
CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id ),
|
182 |
|
|
CONSTRAINT locationevent_location_id FOREIGN KEY (location_id)
|
183 |
|
|
REFERENCES location (location_id) MATCH SIMPLE
|
184 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
185 |
|
|
CONSTRAINT locationevent_project_id FOREIGN KEY (project_id)
|
186 |
|
|
REFERENCES project (project_id) MATCH SIMPLE
|
187 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
188 |
586
|
aaronmk
|
CONSTRAINT locationevent_keys_accessioncode UNIQUE (location_id , project_id , sourceaccessioncode ),
|
189 |
|
|
CONSTRAINT locationevent_keys_code UNIQUE (location_id , project_id , authoreventcode )
|
190 |
536
|
aaronmk
|
);
|
191 |
|
|
|
192 |
|
|
CREATE TABLE taxonoccurrence -- VegBank's taxonobservation table.
|
193 |
|
|
(
|
194 |
|
|
taxonoccurrence_id int(11) NOT NULL AUTO_INCREMENT,
|
195 |
605
|
aaronmk
|
locationevent_id int(11),
|
196 |
536
|
aaronmk
|
authorplantname character varying(255),
|
197 |
|
|
reference_id int(11),
|
198 |
|
|
taxoninferencearea double precision,
|
199 |
|
|
emb_taxonoccurrence int(11),
|
200 |
561
|
aaronmk
|
`... (truncated) ...` int(11),
|
201 |
536
|
aaronmk
|
accessioncode character varying(255),
|
202 |
|
|
CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id ),
|
203 |
|
|
CONSTRAINT taxonoccurrence_locationevent_id FOREIGN KEY (locationevent_id)
|
204 |
|
|
REFERENCES locationevent (locationevent_id) MATCH SIMPLE
|
205 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
206 |
|
|
CONSTRAINT taxonoccurrence_reference_id FOREIGN KEY (reference_id)
|
207 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
208 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
209 |
|
|
);
|
210 |
|
|
|
211 |
|
|
CREATE TABLE aggregateoccurrence -- VegBank's taxonimportance table.
|
212 |
|
|
(
|
213 |
|
|
aggregateoccurrence_id int(11) NOT NULL AUTO_INCREMENT,
|
214 |
|
|
taxonoccurrence_id int(11) NOT NULL,
|
215 |
|
|
cover double precision,
|
216 |
|
|
basalarea double precision,
|
217 |
|
|
biomass double precision,
|
218 |
|
|
inferencearea double precision,
|
219 |
|
|
stratumbase double precision,
|
220 |
|
|
stratumheight double precision,
|
221 |
|
|
emb_aggregateoccurrence int(11),
|
222 |
|
|
covercode character varying(10),
|
223 |
607
|
aaronmk
|
count int(11),
|
224 |
536
|
aaronmk
|
accessioncode character varying(255),
|
225 |
586
|
aaronmk
|
sourceaccessioncode character varying(100),
|
226 |
671
|
aaronmk
|
plantobservation_id int(11),
|
227 |
677
|
aaronmk
|
stratum_id int(11),
|
228 |
678
|
aaronmk
|
sizeclass_id int(11),
|
229 |
|
|
coverindex_id int(11),
|
230 |
536
|
aaronmk
|
CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id ),
|
231 |
671
|
aaronmk
|
CONSTRAINT aggregateoccurrence_plantobservation_id FOREIGN KEY (plantobservation_id)
|
232 |
|
|
REFERENCES plantobservation (plantobservation_id) MATCH SIMPLE
|
233 |
666
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
234 |
678
|
aaronmk
|
CONSTRAINT aggregateoccurrence_sizeclass_id FOREIGN KEY (sizeclass_id)
|
235 |
|
|
REFERENCES sizeclass (sizeclass_id) MATCH SIMPLE
|
236 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
237 |
677
|
aaronmk
|
CONSTRAINT aggregateoccurrence_stratum_id FOREIGN KEY (stratum_id)
|
238 |
|
|
REFERENCES stratum (stratum_id) MATCH SIMPLE
|
239 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
240 |
536
|
aaronmk
|
CONSTRAINT aggregateoccurrence_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
|
241 |
|
|
REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
|
242 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
243 |
679
|
aaronmk
|
CONSTRAINT aggregateoccurrence_keys_accessioncode UNIQUE (taxonoccurrence_id , sourceaccessioncode )
|
244 |
536
|
aaronmk
|
);
|
245 |
|
|
|
246 |
674
|
aaronmk
|
CREATE TABLE plant -- A physical, tagged plant.
|
247 |
|
|
(
|
248 |
|
|
plant_id int(11) NOT NULL AUTO_INCREMENT,
|
249 |
|
|
CONSTRAINT plant_pkey PRIMARY KEY (plant_id )
|
250 |
|
|
);
|
251 |
|
|
|
252 |
|
|
CREATE TABLE planttag
|
253 |
|
|
(
|
254 |
|
|
planttag_id int(11) NOT NULL AUTO_INCREMENT,
|
255 |
|
|
plant_id int(11) NOT NULL,
|
256 |
|
|
tag character varying(255) NOT NULL,
|
257 |
|
|
CONSTRAINT planttag_pkey PRIMARY KEY (planttag_id ),
|
258 |
|
|
CONSTRAINT planttag_plant_id FOREIGN KEY (plant_id)
|
259 |
|
|
REFERENCES plant (plant_id) MATCH SIMPLE
|
260 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
261 |
|
|
CONSTRAINT planttag_keys UNIQUE (plant_id , tag )
|
262 |
|
|
);
|
263 |
|
|
|
264 |
671
|
aaronmk
|
CREATE TABLE plantobservation -- VegBank's stemcount table.
|
265 |
536
|
aaronmk
|
(
|
266 |
671
|
aaronmk
|
plantobservation_id int(11) NOT NULL AUTO_INCREMENT,
|
267 |
563
|
aaronmk
|
overallheight double precision,
|
268 |
|
|
overallheightaccuracy double precision,
|
269 |
671
|
aaronmk
|
emb_plantobservation int(11),
|
270 |
570
|
aaronmk
|
authorplantcode character varying(20),
|
271 |
536
|
aaronmk
|
accessioncode character varying(255),
|
272 |
|
|
stemcount int(11),
|
273 |
586
|
aaronmk
|
sourceaccessioncode character varying(100),
|
274 |
674
|
aaronmk
|
plant_id int(11),
|
275 |
671
|
aaronmk
|
CONSTRAINT plantobservation_pkey PRIMARY KEY (plantobservation_id ),
|
276 |
674
|
aaronmk
|
CONSTRAINT plantobservation_plant_id FOREIGN KEY (plant_id)
|
277 |
|
|
REFERENCES plant (plant_id) MATCH SIMPLE
|
278 |
682
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE
|
279 |
536
|
aaronmk
|
);
|
280 |
|
|
|
281 |
673
|
aaronmk
|
CREATE TABLE stemobservation -- VegBank's stemlocation table.
|
282 |
536
|
aaronmk
|
(
|
283 |
673
|
aaronmk
|
stemobservation_id int(11) NOT NULL AUTO_INCREMENT,
|
284 |
671
|
aaronmk
|
plantobservation_id int(11) NOT NULL,
|
285 |
570
|
aaronmk
|
authorstemcode character varying(20),
|
286 |
536
|
aaronmk
|
xposition double precision,
|
287 |
|
|
yposition double precision,
|
288 |
|
|
health character varying(50),
|
289 |
673
|
aaronmk
|
emb_stemobservation int(11),
|
290 |
536
|
aaronmk
|
diameter double precision,
|
291 |
|
|
height double precision,
|
292 |
|
|
heightaccuracy double precision,
|
293 |
|
|
age double precision,
|
294 |
|
|
accessioncode character varying(255),
|
295 |
556
|
aaronmk
|
diameteraccuracy double precision,
|
296 |
586
|
aaronmk
|
sourceaccessioncode character varying(100),
|
297 |
673
|
aaronmk
|
CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id ),
|
298 |
|
|
CONSTRAINT stemobservation_plantobservation_id FOREIGN KEY (plantobservation_id)
|
299 |
671
|
aaronmk
|
REFERENCES plantobservation (plantobservation_id) MATCH SIMPLE
|
300 |
536
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
301 |
673
|
aaronmk
|
CONSTRAINT stemobservation_keys_accessioncode UNIQUE (plantobservation_id , sourceaccessioncode ),
|
302 |
|
|
CONSTRAINT stemobservation_keys_code UNIQUE (plantobservation_id , authorstemcode )
|
303 |
536
|
aaronmk
|
);
|
304 |
|
|
|
305 |
670
|
aaronmk
|
CREATE TABLE specimen -- A physical specimen collected from a plant. Used to link replicates of the same specimen together.
|
306 |
669
|
aaronmk
|
(
|
307 |
|
|
specimen_id int(11) NOT NULL AUTO_INCREMENT,
|
308 |
|
|
CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id )
|
309 |
|
|
);
|
310 |
|
|
|
311 |
670
|
aaronmk
|
CREATE TABLE specimenreplicate -- A herbarium's replicate of a specimen. Contains Darwin Core specimen data.
|
312 |
537
|
aaronmk
|
(
|
313 |
668
|
aaronmk
|
specimenreplicate_id int(11) NOT NULL AUTO_INCREMENT,
|
314 |
537
|
aaronmk
|
reference_id int(11) NOT NULL,
|
315 |
668
|
aaronmk
|
collectioncode_dwc character varying(255), -- The code for the collection that the specimenreplicate is from.
|
316 |
537
|
aaronmk
|
catalognumber_dwc character varying(255),
|
317 |
578
|
aaronmk
|
collectiondate timestamp NULL,
|
318 |
537
|
aaronmk
|
museum_id int(11),
|
319 |
586
|
aaronmk
|
sourceaccessioncode character varying(100),
|
320 |
537
|
aaronmk
|
accessioncode character varying(255),
|
321 |
576
|
aaronmk
|
taxonoccurrence_id int(11) NOT NULL,
|
322 |
613
|
aaronmk
|
verbatimcollectorname character varying(255),
|
323 |
668
|
aaronmk
|
collectionnumber character varying(255), -- The number of the specimenreplicate within the collection.
|
324 |
669
|
aaronmk
|
specimen_id int(11),
|
325 |
668
|
aaronmk
|
CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id ),
|
326 |
|
|
CONSTRAINT specimenreplicate_museum_id FOREIGN KEY (museum_id)
|
327 |
537
|
aaronmk
|
REFERENCES party (party_id) MATCH SIMPLE
|
328 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
329 |
668
|
aaronmk
|
CONSTRAINT specimenreplicate_reference_id_fkey FOREIGN KEY (reference_id)
|
330 |
537
|
aaronmk
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
331 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
332 |
669
|
aaronmk
|
CONSTRAINT specimenreplicate_specimen_id FOREIGN KEY (specimen_id)
|
333 |
|
|
REFERENCES specimen (specimen_id) MATCH SIMPLE
|
334 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
335 |
668
|
aaronmk
|
CONSTRAINT specimenreplicate_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
|
336 |
537
|
aaronmk
|
REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
|
337 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
338 |
668
|
aaronmk
|
CONSTRAINT specimenreplicate_keys_accessioncode UNIQUE (reference_id , collectioncode_dwc , sourceaccessioncode ),
|
339 |
|
|
CONSTRAINT specimenreplicate_keys_catalognumber UNIQUE (reference_id , collectioncode_dwc , catalognumber_dwc ),
|
340 |
672
|
aaronmk
|
CONSTRAINT specimenreplicate_keys_collectionnumber UNIQUE (reference_id , collectioncode_dwc , collectionnumber )
|
341 |
537
|
aaronmk
|
);
|
342 |
|
|
|
343 |
544
|
aaronmk
|
CREATE TABLE voucher
|
344 |
|
|
(
|
345 |
|
|
voucher_id int(11) NOT NULL AUTO_INCREMENT,
|
346 |
545
|
aaronmk
|
taxonoccurrence_id int(11) NOT NULL,
|
347 |
668
|
aaronmk
|
specimenreplicate_id int(11) NOT NULL,
|
348 |
544
|
aaronmk
|
accessioncode character varying(255),
|
349 |
|
|
CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id ),
|
350 |
668
|
aaronmk
|
CONSTRAINT voucher_specimenreplicate_id FOREIGN KEY (specimenreplicate_id)
|
351 |
|
|
REFERENCES specimenreplicate (specimenreplicate_id) MATCH SIMPLE
|
352 |
544
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
353 |
|
|
CONSTRAINT voucher_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
|
354 |
|
|
REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
|
355 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
356 |
668
|
aaronmk
|
CONSTRAINT voucher_keys UNIQUE (taxonoccurrence_id , specimenreplicate_id )
|
357 |
544
|
aaronmk
|
);
|
358 |
|
|
|
359 |
536
|
aaronmk
|
CREATE TABLE taxondetermination -- VegBank's taxoninterpretation table.
|
360 |
|
|
(
|
361 |
|
|
taxondetermination_id int(11) NOT NULL AUTO_INCREMENT,
|
362 |
|
|
taxonoccurrence_id int(11) NOT NULL,
|
363 |
|
|
plantconcept_id int(11) NOT NULL,
|
364 |
575
|
aaronmk
|
party_id int(11),
|
365 |
536
|
aaronmk
|
role_id int(11) NOT NULL,
|
366 |
|
|
determinationtype character varying(30),
|
367 |
|
|
reference_id int(11),
|
368 |
632
|
aaronmk
|
isoriginal int(1) NOT NULL DEFAULT false,
|
369 |
|
|
iscurrent int(1) NOT NULL DEFAULT false,
|
370 |
536
|
aaronmk
|
taxonfit character varying(50),
|
371 |
|
|
taxonconfidence character varying(50),
|
372 |
|
|
grouptype character varying(20),
|
373 |
|
|
notes text,
|
374 |
|
|
notespublic int(1),
|
375 |
|
|
notesmgt int(1),
|
376 |
|
|
revisions int(1),
|
377 |
591
|
aaronmk
|
determinationdate timestamp NULL,
|
378 |
536
|
aaronmk
|
emb_taxondetermination int(11),
|
379 |
|
|
accessioncode character varying(255),
|
380 |
|
|
CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id ),
|
381 |
|
|
CONSTRAINT taxondetermination_party_id FOREIGN KEY (party_id)
|
382 |
|
|
REFERENCES party (party_id) MATCH SIMPLE
|
383 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
384 |
|
|
CONSTRAINT taxondetermination_plantconcept_id FOREIGN KEY (plantconcept_id)
|
385 |
|
|
REFERENCES plantconcept (plantconcept_id) MATCH SIMPLE
|
386 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
387 |
|
|
CONSTRAINT taxondetermination_reference_id FOREIGN KEY (reference_id)
|
388 |
|
|
REFERENCES reference (reference_id) MATCH SIMPLE
|
389 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
390 |
|
|
CONSTRAINT taxondetermination_role_id FOREIGN KEY (role_id)
|
391 |
596
|
aaronmk
|
REFERENCES role (role_id) MATCH SIMPLE
|
392 |
536
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
393 |
|
|
CONSTRAINT taxondetermination_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
|
394 |
|
|
REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
|
395 |
|
|
ON UPDATE CASCADE ON DELETE CASCADE
|
396 |
|
|
);
|
397 |
|
|
|
398 |
552
|
aaronmk
|
CREATE TABLE stratum
|
399 |
|
|
(
|
400 |
|
|
stratum_id int(11) NOT NULL AUTO_INCREMENT,
|
401 |
|
|
locationevent_id int(11) NOT NULL,
|
402 |
|
|
stratumtype_id int(11) NOT NULL,
|
403 |
|
|
stratumheight double precision,
|
404 |
|
|
stratumbase double precision,
|
405 |
|
|
stratumcover double precision,
|
406 |
676
|
aaronmk
|
area double precision,
|
407 |
552
|
aaronmk
|
CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id ),
|
408 |
|
|
CONSTRAINT stratum_locationevent_id FOREIGN KEY (locationevent_id)
|
409 |
|
|
REFERENCES locationevent (locationevent_id) MATCH SIMPLE
|
410 |
592
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
411 |
|
|
CONSTRAINT stratum_stratumtype_id FOREIGN KEY (stratumtype_id)
|
412 |
|
|
REFERENCES stratumtype (stratumtype_id) MATCH SIMPLE
|
413 |
559
|
aaronmk
|
ON UPDATE CASCADE ON DELETE CASCADE
|
414 |
552
|
aaronmk
|
);
|
415 |
|
|
|
416 |
537
|
aaronmk
|
CREATE TABLE sizeclass -- A range of size measurements used to aggregate organisms.
|
417 |
536
|
aaronmk
|
(
|
418 |
537
|
aaronmk
|
sizeclass_id int(11) NOT NULL AUTO_INCREMENT,
|
419 |
|
|
mindiameter double precision,
|
420 |
|
|
minheight double precision,
|
421 |
|
|
maxdiameter double precision,
|
422 |
|
|
maxheight double precision,
|
423 |
536
|
aaronmk
|
accessioncode character varying(255),
|
424 |
537
|
aaronmk
|
CONSTRAINT sizeclass_pkey PRIMARY KEY (sizeclass_id )
|
425 |
536
|
aaronmk
|
);
|