Project

General

Profile

« Previous | Next » 

Revision 674

vegbien.sql: Added plant and planttag tables

View differences:

vegbien.for_ERD.my.sql
239 239
  CONSTRAINT aggregateoccurrence_keys_method UNIQUE (taxonoccurrence_id , taxonbinmethod_id )
240 240
);
241 241

  
242
CREATE TABLE plant -- A physical, tagged plant.
243
(
244
  plant_id int(11) NOT NULL AUTO_INCREMENT,
245
  CONSTRAINT plant_pkey PRIMARY KEY (plant_id )
246
);
247

  
248
CREATE TABLE planttag
249
(
250
  planttag_id int(11) NOT NULL AUTO_INCREMENT,
251
  plant_id int(11) NOT NULL,
252
  tag character varying(255) NOT NULL,
253
  CONSTRAINT planttag_pkey PRIMARY KEY (planttag_id ),
254
  CONSTRAINT planttag_plant_id FOREIGN KEY (plant_id)
255
      REFERENCES plant (plant_id) MATCH SIMPLE
256
      ON UPDATE CASCADE ON DELETE CASCADE,
257
  CONSTRAINT planttag_keys UNIQUE (plant_id , tag )
258
);
259

  
242 260
CREATE TABLE plantobservation -- VegBank's stemcount table.
243 261
(
244 262
  plantobservation_id int(11) NOT NULL AUTO_INCREMENT,
......
250 268
  accessioncode character varying(255),
251 269
  stemcount int(11),
252 270
  sourceaccessioncode character varying(100),
271
  plant_id int(11),
253 272
  CONSTRAINT plantobservation_pkey PRIMARY KEY (plantobservation_id ),
254 273
  CONSTRAINT plantobservation_aggregateoccurrence_id FOREIGN KEY (aggregateoccurrence_id)
255 274
      REFERENCES aggregateoccurrence (aggregateoccurrence_id) MATCH SIMPLE
256 275
      ON UPDATE CASCADE ON DELETE CASCADE,
276
  CONSTRAINT plantobservation_plant_id FOREIGN KEY (plant_id)
277
      REFERENCES plant (plant_id) MATCH SIMPLE
278
      ON UPDATE CASCADE ON DELETE CASCADE,
257 279
  CONSTRAINT plantobservation_aggregateoccurrence_id_1_to_1 UNIQUE (aggregateoccurrence_id )
258 280
);
259 281

  

Also available in: Unified diff