Revision 570
Added by Aaron Marcuse-Kubitza almost 13 years ago
vegbien.for_ERD.sql | ||
---|---|---|
111 | 111 |
CREATE TABLE location |
112 | 112 |
( |
113 | 113 |
location_id serial NOT NULL, |
114 |
sourceid character varying(30),
|
|
114 |
authorlocationcode character varying(30),
|
|
115 | 115 |
reference_id integer, |
116 | 116 |
parent_id integer, |
117 | 117 |
reallatitude double precision, |
... | ... | |
136 | 136 |
CONSTRAINT location_reference_id FOREIGN KEY (reference_id) |
137 | 137 |
REFERENCES reference (reference_id) MATCH SIMPLE |
138 | 138 |
ON UPDATE CASCADE ON DELETE CASCADE, |
139 |
CONSTRAINT location_keys UNIQUE (reference_id , parent_id , sourceid )
|
|
139 |
CONSTRAINT location_keys UNIQUE (reference_id , parent_id , authorlocationcode )
|
|
140 | 140 |
); |
141 | 141 |
|
142 | 142 |
CREATE TABLE locationevent -- VegBank's observation table. |
... | ... | |
145 | 145 |
previous_id integer, |
146 | 146 |
location_id integer NOT NULL, |
147 | 147 |
project_id integer, |
148 |
sourceid character varying(30),
|
|
148 |
authoreventcode character varying(30),
|
|
149 | 149 |
"... (truncated) ..." integer, |
150 | 150 |
accessioncode character varying(255), |
151 | 151 |
CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id ), |
... | ... | |
155 | 155 |
CONSTRAINT locationevent_project_id FOREIGN KEY (project_id) |
156 | 156 |
REFERENCES project (project_id) MATCH SIMPLE |
157 | 157 |
ON UPDATE CASCADE ON DELETE CASCADE, |
158 |
CONSTRAINT locationevent_keys UNIQUE (location_id , project_id , sourceid )
|
|
158 |
CONSTRAINT locationevent_keys UNIQUE (location_id , project_id , authoreventcode )
|
|
159 | 159 |
); |
160 | 160 |
|
161 | 161 |
CREATE TABLE taxonoccurrence -- VegBank's taxonobservation table. |
... | ... | |
209 | 209 |
overallheight double precision, |
210 | 210 |
overallheightaccuracy double precision, |
211 | 211 |
emb_individualplant integer, |
212 |
sourceid character varying(20),
|
|
212 |
authorplantcode character varying(20),
|
|
213 | 213 |
accessioncode character varying(255), |
214 | 214 |
stemcount integer, |
215 | 215 |
CONSTRAINT individualplant_pkey PRIMARY KEY (individualplant_id ), |
216 | 216 |
CONSTRAINT individualplant_aggregateoccurrence_id FOREIGN KEY (aggregateoccurrence_id) |
217 | 217 |
REFERENCES aggregateoccurrence (aggregateoccurrence_id) MATCH SIMPLE |
218 | 218 |
ON UPDATE CASCADE ON DELETE CASCADE, |
219 |
CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id , sourceid )
|
|
219 |
CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id , authorplantcode )
|
|
220 | 220 |
); |
221 | 221 |
|
222 | 222 |
CREATE TABLE stem -- VegBank's stemlocation table. |
223 | 223 |
( |
224 | 224 |
stem_id serial NOT NULL, |
225 | 225 |
individualplant_id integer NOT NULL, |
226 |
sourceid character varying(20),
|
|
226 |
authorstemcode character varying(20),
|
|
227 | 227 |
xposition double precision, |
228 | 228 |
yposition double precision, |
229 | 229 |
health character varying(50), |
... | ... | |
238 | 238 |
CONSTRAINT stem_individualplant_id FOREIGN KEY (individualplant_id) |
239 | 239 |
REFERENCES individualplant (individualplant_id) MATCH SIMPLE |
240 | 240 |
ON UPDATE CASCADE ON DELETE CASCADE, |
241 |
CONSTRAINT stem_keys UNIQUE (individualplant_id , sourceid )
|
|
241 |
CONSTRAINT stem_keys UNIQUE (individualplant_id , authorstemcode )
|
|
242 | 242 |
); |
243 | 243 |
|
244 | 244 |
CREATE TABLE specimen -- A herbarium specimen. Contains Darwin Core specimen data. |
Also available in: Unified diff
VegBIEN: Renamed sourceid to author*code