Project

General

Profile

« Previous | Next » 

Revision 4934

schemas/vegbien.sql: Scope taxonpath instead of taxon with taxonscope, because a morphospecies name is specific to a datasource entity, so it should go in the datasource-specific taxonpath table instead of the datasource-general taxon table

View differences:

schemas/vegbien.my.sql
848 848
    forma text,
849 849
    cultivar text,
850 850
    otherranks text,
851
    scope_id int(11),
851 852
    accessioncode text
852 853
);
853 854

  
......
874 875

  
875 876

  
876 877
--
878
-- Name: COLUMN taxonpath.scope_id; Type: COMMENT; Schema: public; Owner: -
879
--
880

  
881

  
882

  
883

  
884
--
877 885
-- Name: analytical_db_view; Type: VIEW; Schema: public; Owner: -
878 886
--
879 887

  
......
2374 2382
CREATE TABLE taxon (
2375 2383
    taxon_id int(11) NOT NULL,
2376 2384
    parent_id int(11),
2377
    scope_id int(11),
2378 2385
    rank text NOT NULL,
2379 2386
    verbatimrank text,
2380 2387
    taxonname text NOT NULL,
......
4957 4964

  
4958 4965

  
4959 4966
--
4960
-- Name: taxon_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4961
--
4962

  
4963
ALTER TABLE taxon
4964
    ADD CONSTRAINT taxon_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
4965

  
4966

  
4967
--
4968 4967
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4969 4968
--
4970 4969

  
......
5033 5032

  
5034 5033

  
5035 5034
--
5035
-- Name: taxonpath_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5036
--
5037

  
5038
ALTER TABLE taxonpath
5039
    ADD CONSTRAINT taxonpath_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5040

  
5041

  
5042
--
5036 5043
-- Name: taxonpath_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5037 5044
--
5038 5045

  
schemas/vegbien.sql
1132 1132
    forma text,
1133 1133
    cultivar text,
1134 1134
    otherranks rankedtaxonname[],
1135
    scope_id integer,
1135 1136
    accessioncode text
1136 1137
);
1137 1138

  
......
1158 1159

  
1159 1160

  
1160 1161
--
1162
-- Name: COLUMN taxonpath.scope_id; Type: COMMENT; Schema: public; Owner: -
1163
--
1164

  
1165
COMMENT ON COLUMN taxonpath.scope_id IS 'The morphospecies scope';
1166

  
1167

  
1168
--
1161 1169
-- Name: analytical_db_view; Type: VIEW; Schema: public; Owner: -
1162 1170
--
1163 1171

  
......
2910 2918
CREATE TABLE taxon (
2911 2919
    taxon_id integer NOT NULL,
2912 2920
    parent_id integer,
2913
    scope_id integer,
2914 2921
    rank taxonrank NOT NULL,
2915 2922
    verbatimrank text,
2916 2923
    taxonname text NOT NULL,
......
4608 4615
-- Name: taxon_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4609 4616
--
4610 4617

  
4611
CREATE UNIQUE INDEX taxon_unique ON taxon USING btree ((COALESCE(parent_id, 2147483647)), taxonname, rank, (COALESCE(scope_id, 2147483647)), (COALESCE(author_id, 2147483647)), (COALESCE(authority_id, 2147483647)));
4618
CREATE UNIQUE INDEX taxon_unique ON taxon USING btree ((COALESCE(parent_id, 2147483647)), taxonname, rank, (COALESCE(author_id, 2147483647)), (COALESCE(authority_id, 2147483647)));
4612 4619

  
4613 4620

  
4614 4621
--
......
4671 4678
-- Name: taxonpath_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4672 4679
--
4673 4680

  
4674
CREATE UNIQUE INDEX taxonpath_unique_within_datasource_by_name ON taxonpath USING btree (datasource_id, (COALESCE(taxon_id, 2147483647)), (COALESCE(scientificname, '\\N'::text)), (COALESCE(scientificnameauthor, '\\N'::text)), (COALESCE(scientificnamewithauthor, '\\N'::text)), (COALESCE(domain, '\\N'::text)), (COALESCE(kingdom, '\\N'::text)), (COALESCE(phylum, '\\N'::text)), (COALESCE(class, '\\N'::text)), (COALESCE("order", '\\N'::text)), (COALESCE(family, '\\N'::text)), (COALESCE(genus, '\\N'::text)), (COALESCE(species, '\\N'::text)), (COALESCE(subspecies, '\\N'::text)), (COALESCE(variety, '\\N'::text)), (COALESCE(forma, '\\N'::text)), (COALESCE(cultivar, '\\N'::text))) WHERE (plantcode IS NULL);
4681
CREATE UNIQUE INDEX taxonpath_unique_within_datasource_by_name ON taxonpath USING btree (datasource_id, (COALESCE(taxon_id, 2147483647)), (COALESCE(scientificname, '\\N'::text)), (COALESCE(scientificnameauthor, '\\N'::text)), (COALESCE(scientificnamewithauthor, '\\N'::text)), (COALESCE(domain, '\\N'::text)), (COALESCE(kingdom, '\\N'::text)), (COALESCE(phylum, '\\N'::text)), (COALESCE(class, '\\N'::text)), (COALESCE("order", '\\N'::text)), (COALESCE(family, '\\N'::text)), (COALESCE(genus, '\\N'::text)), (COALESCE(species, '\\N'::text)), (COALESCE(subspecies, '\\N'::text)), (COALESCE(variety, '\\N'::text)), (COALESCE(forma, '\\N'::text)), (COALESCE(cultivar, '\\N'::text)), (COALESCE(scope_id, 2147483647))) WHERE (plantcode IS NULL);
4675 4682

  
4676 4683

  
4677 4684
--
......
5582 5589

  
5583 5590

  
5584 5591
--
5585
-- Name: taxon_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5586
--
5587

  
5588
ALTER TABLE ONLY taxon
5589
    ADD CONSTRAINT taxon_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5590

  
5591

  
5592
--
5593 5592
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5594 5593
--
5595 5594

  
......
5662 5661

  
5663 5662

  
5664 5663
--
5664
-- Name: taxonpath_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5665
--
5666

  
5667
ALTER TABLE ONLY taxonpath
5668
    ADD CONSTRAINT taxonpath_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5669

  
5670

  
5671
--
5665 5672
-- Name: taxonpath_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5666 5673
--
5667 5674

  

Also available in: Unified diff