Project

General

Profile

« Previous | Next » 

Revision 669

vegbien.sql: Added specimen table to tie specimenreplicates together

View differences:

schemas/vegbien.for_ERD.my.sql
281 281
  CONSTRAINT stem_keys_code UNIQUE (individualplant_id , authorstemcode )
282 282
);
283 283

  
284
CREATE TABLE specimen
285
(
286
  specimen_id int(11) NOT NULL AUTO_INCREMENT,
287
  CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id )
288
);
289

  
284 290
CREATE TABLE specimenreplicate -- A herbarium specimenreplicate. Contains Darwin Core specimenreplicate data.
285 291
(
286 292
  specimenreplicate_id int(11) NOT NULL AUTO_INCREMENT,
......
294 300
  taxonoccurrence_id int(11) NOT NULL,
295 301
  verbatimcollectorname character varying(255),
296 302
  collectionnumber character varying(255), -- The number of the specimenreplicate within the collection.
303
  specimen_id int(11),
297 304
  CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id ),
298 305
  CONSTRAINT specimenreplicate_museum_id FOREIGN KEY (museum_id)
299 306
      REFERENCES party (party_id) MATCH SIMPLE
......
301 308
  CONSTRAINT specimenreplicate_reference_id_fkey FOREIGN KEY (reference_id)
302 309
      REFERENCES reference (reference_id) MATCH SIMPLE
303 310
      ON UPDATE CASCADE ON DELETE CASCADE,
311
  CONSTRAINT specimenreplicate_specimen_id FOREIGN KEY (specimen_id)
312
      REFERENCES specimen (specimen_id) MATCH SIMPLE
313
      ON UPDATE CASCADE ON DELETE CASCADE,
304 314
  CONSTRAINT specimenreplicate_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
305 315
      REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
306 316
      ON UPDATE CASCADE ON DELETE CASCADE,
schemas/vegbien.for_wiki.sql
92 92
  sourceaccessioncode character varying(100),
93 93
);
94 94

  
95
CREATE TABLE specimen
96
(
97
  specimen_id serial NOT NULL,
98
);
99

  
95 100
CREATE TABLE specimenreplicate -- A herbarium specimenreplicate. Contains Darwin Core specimenreplicate data.
96 101
(
97 102
  specimenreplicate_id serial NOT NULL,
......
105 110
  taxonoccurrence_id integer NOT NULL,
106 111
  verbatimcollectorname character varying(255),
107 112
  collectionnumber character varying(255), -- The number of the specimenreplicate within the collection.
113
  specimen_id integer,
108 114
);
109 115

  
110 116
CREATE TABLE voucher
schemas/vegbien_empty.sql
59 59
TRUNCATE sizeclass CASCADE;
60 60
TRUNCATE soilobs CASCADE;
61 61
TRUNCATE soiltaxon CASCADE;
62
TRUNCATE specimen CASCADE;
62 63
TRUNCATE specimenreplicate CASCADE;
63 64
TRUNCATE stem CASCADE;
64 65
TRUNCATE stratum CASCADE;
schemas/vegbien.for_ERD.sql
281 281
  CONSTRAINT stem_keys_code UNIQUE (individualplant_id , authorstemcode )
282 282
);
283 283

  
284
CREATE TABLE specimen
285
(
286
  specimen_id serial NOT NULL,
287
  CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id )
288
);
289

  
284 290
CREATE TABLE specimenreplicate -- A herbarium specimenreplicate. Contains Darwin Core specimenreplicate data.
285 291
(
286 292
  specimenreplicate_id serial NOT NULL,
......
294 300
  taxonoccurrence_id integer NOT NULL,
295 301
  verbatimcollectorname character varying(255),
296 302
  collectionnumber character varying(255), -- The number of the specimenreplicate within the collection.
303
  specimen_id integer,
297 304
  CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id ),
298 305
  CONSTRAINT specimenreplicate_museum_id FOREIGN KEY (museum_id)
299 306
      REFERENCES party (party_id) MATCH SIMPLE
......
301 308
  CONSTRAINT specimenreplicate_reference_id_fkey FOREIGN KEY (reference_id)
302 309
      REFERENCES reference (reference_id) MATCH SIMPLE
303 310
      ON UPDATE CASCADE ON DELETE CASCADE,
311
  CONSTRAINT specimenreplicate_specimen_id FOREIGN KEY (specimen_id)
312
      REFERENCES specimen (specimen_id) MATCH SIMPLE
313
      ON UPDATE CASCADE ON DELETE CASCADE,
304 314
  CONSTRAINT specimenreplicate_taxonoccurrence_id FOREIGN KEY (taxonoccurrence_id)
305 315
      REFERENCES taxonoccurrence (taxonoccurrence_id) MATCH SIMPLE
306 316
      ON UPDATE CASCADE ON DELETE CASCADE,
schemas/vegbien.sql
2260 2260
SET default_with_oids = false;
2261 2261

  
2262 2262
--
2263
-- Name: specimen; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2264
--
2265

  
2266
CREATE TABLE specimen (
2267
    specimen_id integer NOT NULL
2268
);
2269

  
2270

  
2271
--
2272
-- Name: specimen_specimen_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2273
--
2274

  
2275
CREATE SEQUENCE specimen_specimen_id_seq
2276
    START WITH 1
2277
    INCREMENT BY 1
2278
    NO MINVALUE
2279
    NO MAXVALUE
2280
    CACHE 1;
2281

  
2282

  
2283
--
2284
-- Name: specimen_specimen_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2285
--
2286

  
2287
ALTER SEQUENCE specimen_specimen_id_seq OWNED BY specimen.specimen_id;
2288

  
2289

  
2290
--
2263 2291
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2264 2292
--
2265 2293

  
......
2274 2302
    accessioncode character varying(255),
2275 2303
    taxonoccurrence_id integer NOT NULL,
2276 2304
    verbatimcollectorname character varying(255),
2277
    collectionnumber character varying(255)
2305
    collectionnumber character varying(255),
2306
    specimen_id integer
2278 2307
);
2279 2308

  
2280 2309

  
......
3611 3640

  
3612 3641

  
3613 3642
--
3643
-- Name: specimen_id; Type: DEFAULT; Schema: public; Owner: -
3644
--
3645

  
3646
ALTER TABLE specimen ALTER COLUMN specimen_id SET DEFAULT nextval('specimen_specimen_id_seq'::regclass);
3647

  
3648

  
3649
--
3614 3650
-- Name: specimenreplicate_id; Type: DEFAULT; Schema: public; Owner: -
3615 3651
--
3616 3652

  
......
4387 4423

  
4388 4424

  
4389 4425
--
4426
-- Name: specimen_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4427
--
4428

  
4429
ALTER TABLE ONLY specimen
4430
    ADD CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id);
4431

  
4432

  
4433
--
4390 4434
-- Name: specimenreplicate_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4391 4435
--
4392 4436

  
......
5057 5101

  
5058 5102

  
5059 5103
--
5104
-- Name: fki_specimenreplicate_specimen_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5105
--
5106

  
5107
CREATE INDEX fki_specimenreplicate_specimen_id ON specimenreplicate USING btree (specimen_id);
5108

  
5109

  
5110
--
5060 5111
-- Name: fki_taxonbinmethod_sizeclass_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5061 5112
--
5062 5113

  
......
6590 6641

  
6591 6642

  
6592 6643
--
6644
-- Name: specimenreplicate_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6645
--
6646

  
6647
ALTER TABLE ONLY specimenreplicate
6648
    ADD CONSTRAINT specimenreplicate_specimen_id FOREIGN KEY (specimen_id) REFERENCES specimen(specimen_id) ON UPDATE CASCADE ON DELETE CASCADE;
6649

  
6650

  
6651
--
6593 6652
-- Name: specimenreplicate_taxonoccurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6594 6653
--
6595 6654

  

Also available in: Unified diff