Project

General

Profile

« Previous | Next » 

Revision 592

vegbien.sql: taxonbinmethod points to stratumtype instead of stratum because stratumtype is a method table, but stratum is a measurements table. stratum does not point directly to stratummethod because it points to it via stratumtype.

View differences:

vegbien.for_ERD.my.sql
58 58
      ON UPDATE CASCADE ON DELETE CASCADE
59 59
);
60 60

  
61
CREATE TABLE stratummethod
62
(
63
  stratummethod_id int(11) NOT NULL AUTO_INCREMENT,
64
  reference_id int(11),
65
  stratummethodname character varying(30) NOT NULL,
66
  stratummethoddescription text,
67
  stratumassignment character varying(50),
68
  accessioncode character varying(255),
69
  CONSTRAINT stratummethod_pkey PRIMARY KEY (stratummethod_id ),
70
  CONSTRAINT stratummethod_reference_id FOREIGN KEY (reference_id)
71
      REFERENCES reference (reference_id) MATCH SIMPLE
72
      ON UPDATE CASCADE ON DELETE CASCADE
73
);
74

  
75
CREATE TABLE stratumtype
76
(
77
  stratumtype_id int(11) NOT NULL AUTO_INCREMENT,
78
  stratummethod_id int(11) NOT NULL,
79
  stratumindex character varying(10),
80
  stratumname character varying(30),
81
  stratumdescription text,
82
  CONSTRAINT stratumtype_pkey PRIMARY KEY (stratumtype_id ),
83
  CONSTRAINT stratumtype_stratummethod_id FOREIGN KEY (stratummethod_id)
84
      REFERENCES stratummethod (stratummethod_id) MATCH SIMPLE
85
      ON UPDATE CASCADE ON DELETE CASCADE
86
);
87

  
61 88
CREATE TABLE namedplace
62 89
(
63 90
  namedplace_id int(11) NOT NULL AUTO_INCREMENT,
......
353 380
  CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id ),
354 381
  CONSTRAINT stratum_locationevent_id FOREIGN KEY (locationevent_id)
355 382
      REFERENCES locationevent (locationevent_id) MATCH SIMPLE
383
      ON UPDATE CASCADE ON DELETE CASCADE,
384
  CONSTRAINT stratum_stratumtype_id FOREIGN KEY (stratumtype_id)
385
      REFERENCES stratumtype (stratumtype_id) MATCH SIMPLE
356 386
      ON UPDATE CASCADE ON DELETE CASCADE
357 387
);
358 388

  
......
367 397
  CONSTRAINT sizeclass_pkey PRIMARY KEY (sizeclass_id )
368 398
);
369 399

  
370
CREATE TABLE taxonbinmethod -- Defines a set of aggregate measurements. Used by aggregateoccurrence to define how measurements were aggregated.
400
CREATE TABLE taxonbinmethod
371 401
(
372 402
  taxonbinmethod_id int(11) NOT NULL,
373
  label character varying(255) NOT NULL DEFAULT '',
374
  stratum_id int(11),
403
  label character varying(255),
404
  stratumtype_id int(11),
375 405
  sizeclass_id int(11),
376 406
  coverindex_id int(11),
377 407
  accessioncode character varying(255),
......
379 409
  CONSTRAINT taxonbinmethod_sizeclass_id FOREIGN KEY (sizeclass_id)
380 410
      REFERENCES sizeclass (sizeclass_id) MATCH SIMPLE
381 411
      ON UPDATE CASCADE ON DELETE CASCADE,
382
  CONSTRAINT taxonbinmethod_keys UNIQUE (label , stratum_id , sizeclass_id , coverindex_id )
412
  CONSTRAINT taxonbinmethod_stratumtype_id FOREIGN KEY (stratumtype_id)
413
      REFERENCES stratumtype (stratumtype_id) MATCH SIMPLE
414
      ON UPDATE CASCADE ON DELETE CASCADE
383 415
);

Also available in: Unified diff