Revision 684
Added by Aaron Marcuse-Kubitza about 13 years ago
vegbien.for_ERD.my.sql | ||
---|---|---|
243 | 243 |
CONSTRAINT aggregateoccurrence_keys_accessioncode UNIQUE (taxonoccurrence_id , sourceaccessioncode ) |
244 | 244 |
); |
245 | 245 |
|
246 |
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 | 246 |
CREATE TABLE planttag |
253 | 247 |
( |
254 | 248 |
planttag_id int(11) NOT NULL AUTO_INCREMENT, |
255 |
plant_id int(11) NOT NULL, |
|
249 |
plantobservation_id int(11) NOT NULL,
|
|
256 | 250 |
tag character varying(255) NOT NULL, |
251 |
iscurrent int(1) NOT NULL DEFAULT true, |
|
257 | 252 |
CONSTRAINT planttag_pkey PRIMARY KEY (planttag_id ), |
258 |
CONSTRAINT planttag_plant_id FOREIGN KEY (plant_id)
|
|
259 |
REFERENCES plant (plant_id) MATCH SIMPLE
|
|
253 |
CONSTRAINT planttag_plantobservation_id FOREIGN KEY (plantobservation_id)
|
|
254 |
REFERENCES plantobservation (plantobservation_id) MATCH SIMPLE
|
|
260 | 255 |
ON UPDATE CASCADE ON DELETE CASCADE, |
261 |
CONSTRAINT planttag_keys UNIQUE (plant_id , tag ) |
|
256 |
CONSTRAINT planttag_current_unique UNIQUE (plantobservation_id , iscurrent ), |
|
257 |
CONSTRAINT planttag_keys UNIQUE (plantobservation_id , tag ) |
|
262 | 258 |
); |
263 | 259 |
|
260 |
CREATE TABLE plant -- A physical, tagged plant. |
|
261 |
( |
|
262 |
plant_id int(11) NOT NULL AUTO_INCREMENT, |
|
263 |
CONSTRAINT plant_pkey PRIMARY KEY (plant_id ) |
|
264 |
); |
|
265 |
|
|
264 | 266 |
CREATE TABLE plantobservation -- VegBank's stemcount table. |
265 | 267 |
( |
266 | 268 |
plantobservation_id int(11) NOT NULL AUTO_INCREMENT, |
Also available in: Unified diff
vegbien.sql: Made planttag a child of plantobservation instead of plant, since tags change over time