Project

General

Profile

« Previous | Next » 

Revision 5857

schemas/vegbien.sql: place: Place custom hierarchy of placenames in placename table instead of in otherranks field

View differences:

schemas/vegbien.my.sql
1017 1017
    stateprovince text,
1018 1018
    county text,
1019 1019
    municipality text,
1020
    site text,
1021
    otherranks text
1020
    site text
1022 1021
);
1023 1022

  
1024 1023

  
......
1037 1036

  
1038 1037

  
1039 1038
--
1040
-- Name: COLUMN place.otherranks; Type: COMMENT; Schema: public; Owner: -
1041
--
1042

  
1043

  
1044

  
1045

  
1046
--
1047 1039
-- Name: plantobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1048 1040
--
1049 1041

  
schemas/vegbien.sql
1549 1549
    county text,
1550 1550
    municipality text,
1551 1551
    site text,
1552
    otherranks rankedplacename[],
1553
    CONSTRAINT place_required_key CHECK (((((((placecode IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)) OR (otherranks IS NOT NULL)))
1552
    CONSTRAINT place_required_key CHECK ((((((placecode IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)))
1554 1553
);
1555 1554

  
1556 1555

  
......
1560 1559

  
1561 1560
COMMENT ON TABLE place IS 'The full path to a place. Can be either verbatim or accepted. For accepted names, points to the identified place.
1562 1561

  
1563
To include a placename at a rank with no explicit column, add it to the otherranks array.';
1562
To use a custom hierarchy of placenames with no explicit column, point to the lowest-rank placename in placename_id.';
1564 1563

  
1565 1564

  
1566 1565
--
......
1573 1572

  
1574 1573

  
1575 1574
--
1576
-- Name: COLUMN place.otherranks; Type: COMMENT; Schema: public; Owner: -
1577
--
1578

  
1579
COMMENT ON COLUMN place.otherranks IS 'Additional ranks which do not have a named column. Put ranks in path order, so that lower-level places come after higher-level places.';
1580

  
1581

  
1582
--
1583 1575
-- Name: plantobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1584 1576
--
1585 1577

  
......
4984 4976
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4985 4977
--
4986 4978

  
4987
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (creator_id, (COALESCE(continent, '\\N'::text)), (COALESCE(country, '\\N'::text)), (COALESCE(stateprovince, '\\N'::text)), (COALESCE(county, '\\N'::text)), (COALESCE(municipality, '\\N'::text)), (COALESCE(site, '\\N'::text)), (COALESCE(otherranks, ARRAY[]::rankedplacename[]))) WHERE (placecode IS NULL);
4979
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (creator_id, (COALESCE(continent, '\\N'::text)), (COALESCE(country, '\\N'::text)), (COALESCE(stateprovince, '\\N'::text)), (COALESCE(county, '\\N'::text)), (COALESCE(municipality, '\\N'::text)), (COALESCE(site, '\\N'::text))) WHERE (placecode IS NULL);
4988 4980

  
4989 4981

  
4990 4982
--

Also available in: Unified diff