Project

General

Profile

« Previous | Next » 

Revision 5231

schemas/vegbien.sql: concept_reference_id: Made it an fkey to party instead of taxonscope, because this is now the entity that defined the taxon concept, and is no longer specific to morphospecies. Removed no longer used table taxonscope.

View differences:

vegbien.sql
1277 1277
-- Name: COLUMN taxonconcept.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
1278 1278
--
1279 1279

  
1280
COMMENT ON COLUMN taxonconcept.concept_reference_id IS 'The morphospecies scope.';
1280
COMMENT ON COLUMN taxonconcept.concept_reference_id IS 'The entity that defined the taxon concept.';
1281 1281

  
1282 1282

  
1283 1283
--
......
3206 3206

  
3207 3207

  
3208 3208
--
3209
-- Name: taxonscope; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3210
--
3211

  
3212
CREATE TABLE taxonscope (
3213
    taxonscope_id integer NOT NULL,
3214
    locationevent_id integer,
3215
    project_id integer,
3216
    place_id integer,
3217
    CONSTRAINT taxonscope_required_key CHECK ((((locationevent_id IS NOT NULL) OR (project_id IS NOT NULL)) OR (place_id IS NOT NULL)))
3218
);
3219

  
3220

  
3221
--
3222
-- Name: TABLE taxonscope; Type: COMMENT; Schema: public; Owner: -
3223
--
3224

  
3225
COMMENT ON TABLE taxonscope IS 'The scope of a morphospecies name.';
3226

  
3227

  
3228
--
3229
-- Name: taxonscope_taxonscope_id_seq; Type: SEQUENCE; Schema: public; Owner: -
3230
--
3231

  
3232
CREATE SEQUENCE taxonscope_taxonscope_id_seq
3233
    START WITH 1
3234
    INCREMENT BY 1
3235
    NO MINVALUE
3236
    NO MAXVALUE
3237
    CACHE 1;
3238

  
3239

  
3240
--
3241
-- Name: taxonscope_taxonscope_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
3242
--
3243

  
3244
ALTER SEQUENCE taxonscope_taxonscope_id_seq OWNED BY taxonscope.taxonscope_id;
3245

  
3246

  
3247
--
3248 3209
-- Name: telephone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3249 3210
--
3250 3211

  
......
3764 3725

  
3765 3726

  
3766 3727
--
3767
-- Name: taxonscope_id; Type: DEFAULT; Schema: public; Owner: -
3768
--
3769

  
3770
ALTER TABLE taxonscope ALTER COLUMN taxonscope_id SET DEFAULT nextval('taxonscope_taxonscope_id_seq'::regclass);
3771

  
3772

  
3773
--
3774 3728
-- Name: telephone_id; Type: DEFAULT; Schema: public; Owner: -
3775 3729
--
3776 3730

  
......
4335 4289

  
4336 4290

  
4337 4291
--
4338
-- Name: taxonscope_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4339
--
4340

  
4341
ALTER TABLE ONLY taxonscope
4342
    ADD CONSTRAINT taxonscope_pkey PRIMARY KEY (taxonscope_id);
4343

  
4344

  
4345
--
4346 4292
-- Name: telephone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4347 4293
--
4348 4294

  
......
4804 4750

  
4805 4751

  
4806 4752
--
4807
-- Name: taxonscope_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4808
--
4809

  
4810
CREATE UNIQUE INDEX taxonscope_unique ON taxonscope USING btree ((COALESCE(locationevent_id, 2147483647)), (COALESCE(project_id, 2147483647)), (COALESCE(place_id, 2147483647)));
4811

  
4812

  
4813
--
4814 4753
-- Name: userdefined_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4815 4754
--
4816 4755

  
......
5761 5700
--
5762 5701

  
5763 5702
ALTER TABLE ONLY taxonconcept
5764
    ADD CONSTRAINT taxonconcept_concept_reference_id_fkey FOREIGN KEY (concept_reference_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5703
    ADD CONSTRAINT taxonconcept_concept_reference_id_fkey FOREIGN KEY (concept_reference_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5765 5704

  
5766 5705

  
5767 5706
--
......
5829 5768

  
5830 5769

  
5831 5770
--
5832
-- Name: taxonscope_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5833
--
5834

  
5835
ALTER TABLE ONLY taxonscope
5836
    ADD CONSTRAINT taxonscope_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5837

  
5838

  
5839
--
5840
-- Name: taxonscope_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5841
--
5842

  
5843
ALTER TABLE ONLY taxonscope
5844
    ADD CONSTRAINT taxonscope_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
5845

  
5846

  
5847
--
5848
-- Name: taxonscope_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5849
--
5850

  
5851
ALTER TABLE ONLY taxonscope
5852
    ADD CONSTRAINT taxonscope_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
5853

  
5854

  
5855
--
5856 5771
-- Name: telephone_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5857 5772
--
5858 5773

  

Also available in: Unified diff