Revision 1555
Added by Aaron Marcuse-Kubitza almost 13 years ago
schemas/vegbien.my.sql | ||
---|---|---|
95 | 95 |
|
96 | 96 |
|
97 | 97 |
-- |
98 |
-- Name: namedplace_update_ancestors(); Type: FUNCTION; Schema: public; Owner: - |
|
99 |
-- |
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
-- |
|
105 |
-- Name: plantname_update_ancestors(); Type: FUNCTION; Schema: public; Owner: - |
|
106 |
-- |
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
-- |
|
98 | 112 |
-- Name: concat(text); Type: AGGREGATE; Schema: public; Owner: - |
99 | 113 |
-- |
100 | 114 |
|
... | ... | |
1180 | 1194 |
); |
1181 | 1195 |
|
1182 | 1196 |
|
1197 |
|
|
1198 |
|
|
1183 | 1199 |
-- |
1200 |
-- Name: namedplace_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1201 |
-- |
|
1202 |
|
|
1203 |
CREATE TABLE namedplace_ancestor ( |
|
1204 |
namedplace_id int(11) NOT NULL, |
|
1205 |
ancestor_id int(11) NOT NULL |
|
1206 |
); |
|
1207 |
|
|
1208 |
|
|
1209 |
-- |
|
1184 | 1210 |
-- Name: namedplace_namedplace_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
1185 | 1211 |
-- |
1186 | 1212 |
|
... | ... | |
1194 | 1220 |
|
1195 | 1221 |
|
1196 | 1222 |
|
1223 |
|
|
1224 |
|
|
1197 | 1225 |
-- |
1198 | 1226 |
-- Name: namedplacecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
1199 | 1227 |
-- |
... | ... | |
1467 | 1495 |
); |
1468 | 1496 |
|
1469 | 1497 |
|
1498 |
|
|
1499 |
|
|
1470 | 1500 |
-- |
1501 |
-- Name: plantname_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1502 |
-- |
|
1503 |
|
|
1504 |
CREATE TABLE plantname_ancestor ( |
|
1505 |
plantname_id int(11) NOT NULL, |
|
1506 |
ancestor_id int(11) NOT NULL |
|
1507 |
); |
|
1508 |
|
|
1509 |
|
|
1510 |
-- |
|
1471 | 1511 |
-- Name: plantname_plantname_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
1472 | 1512 |
-- |
1473 | 1513 |
|
... | ... | |
1481 | 1521 |
|
1482 | 1522 |
|
1483 | 1523 |
|
1484 |
|
|
1485 |
|
|
1486 | 1524 |
-- |
1487 | 1525 |
-- Name: plantnamescope; Type: TABLE; Schema: public; Owner: -; Tablespace: |
1488 | 1526 |
-- |
... | ... | |
3199 | 3237 |
|
3200 | 3238 |
|
3201 | 3239 |
-- |
3240 |
-- Name: namedplace_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
3241 |
-- |
|
3242 |
|
|
3243 |
ALTER TABLE namedplace_ancestor |
|
3244 |
ADD CONSTRAINT namedplace_ancestor_pkey PRIMARY KEY (namedplace_id, ancestor_id); |
|
3245 |
|
|
3246 |
|
|
3247 |
-- |
|
3202 | 3248 |
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
3203 | 3249 |
-- |
3204 | 3250 |
|
... | ... | |
3295 | 3341 |
|
3296 | 3342 |
|
3297 | 3343 |
-- |
3344 |
-- Name: plantname_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
3345 |
-- |
|
3346 |
|
|
3347 |
ALTER TABLE plantname_ancestor |
|
3348 |
ADD CONSTRAINT plantname_ancestor_pkey PRIMARY KEY (plantname_id, ancestor_id); |
|
3349 |
|
|
3350 |
|
|
3351 |
-- |
|
3298 | 3352 |
-- Name: plantname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
3299 | 3353 |
-- |
3300 | 3354 |
|
... | ... | |
3934 | 3988 |
|
3935 | 3989 |
|
3936 | 3990 |
-- |
3991 |
-- Name: fki_namedplace_ancestor_ancestor_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
3992 |
-- |
|
3993 |
|
|
3994 |
CREATE INDEX fki_namedplace_ancestor_ancestor_id ON namedplace_ancestor (ancestor_id); |
|
3995 |
|
|
3996 |
|
|
3997 |
-- |
|
3998 |
-- Name: fki_namedplace_ancestor_namedplace_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
3999 |
-- |
|
4000 |
|
|
4001 |
CREATE INDEX fki_namedplace_ancestor_namedplace_id ON namedplace_ancestor (namedplace_id); |
|
4002 |
|
|
4003 |
|
|
4004 |
-- |
|
3937 | 4005 |
-- Name: fki_namedplace_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
3938 | 4006 |
-- |
3939 | 4007 |
|
... | ... | |
3941 | 4009 |
|
3942 | 4010 |
|
3943 | 4011 |
-- |
4012 |
-- Name: fki_plantname_ancestor_ancestor_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4013 |
-- |
|
4014 |
|
|
4015 |
CREATE INDEX fki_plantname_ancestor_ancestor_id ON plantname_ancestor (ancestor_id); |
|
4016 |
|
|
4017 |
|
|
4018 |
-- |
|
4019 |
-- Name: fki_plantname_ancestor_plantname_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4020 |
-- |
|
4021 |
|
|
4022 |
CREATE INDEX fki_plantname_ancestor_plantname_id ON plantname_ancestor (plantname_id); |
|
4023 |
|
|
4024 |
|
|
4025 |
-- |
|
3944 | 4026 |
-- Name: fki_plantname_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
3945 | 4027 |
-- |
3946 | 4028 |
|
... | ... | |
4683 | 4765 |
|
4684 | 4766 |
|
4685 | 4767 |
-- |
4768 |
-- Name: namedplace_update_ancestors; Type: TRIGGER; Schema: public; Owner: - |
|
4769 |
-- |
|
4770 |
|
|
4771 |
|
|
4772 |
|
|
4773 |
|
|
4774 |
-- |
|
4775 |
-- Name: plantname_update_ancestors; Type: TRIGGER; Schema: public; Owner: - |
|
4776 |
-- |
|
4777 |
|
|
4778 |
|
|
4779 |
|
|
4780 |
|
|
4781 |
-- |
|
4686 | 4782 |
-- Name: address_organization_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
4687 | 4783 |
-- |
4688 | 4784 |
|
... | ... | |
5117 | 5213 |
|
5118 | 5214 |
|
5119 | 5215 |
-- |
5216 |
-- Name: namedplace_ancestor_ancestor_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5217 |
-- |
|
5218 |
|
|
5219 |
ALTER TABLE namedplace_ancestor |
|
5220 |
ADD CONSTRAINT namedplace_ancestor_ancestor_id FOREIGN KEY (ancestor_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5221 |
|
|
5222 |
|
|
5223 |
-- |
|
5224 |
-- Name: namedplace_ancestor_namedplace_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5225 |
-- |
|
5226 |
|
|
5227 |
ALTER TABLE namedplace_ancestor |
|
5228 |
ADD CONSTRAINT namedplace_ancestor_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5229 |
|
|
5230 |
|
|
5231 |
-- |
|
5120 | 5232 |
-- Name: namedplace_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
5121 | 5233 |
-- |
5122 | 5234 |
|
... | ... | |
5220 | 5332 |
|
5221 | 5333 |
|
5222 | 5334 |
-- |
5335 |
-- Name: plantname_ancestor_ancestor_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5336 |
-- |
|
5337 |
|
|
5338 |
ALTER TABLE plantname_ancestor |
|
5339 |
ADD CONSTRAINT plantname_ancestor_ancestor_id FOREIGN KEY (ancestor_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5340 |
|
|
5341 |
|
|
5342 |
-- |
|
5343 |
-- Name: plantname_ancestor_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5344 |
-- |
|
5345 |
|
|
5346 |
ALTER TABLE plantname_ancestor |
|
5347 |
ADD CONSTRAINT plantname_ancestor_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5348 |
|
|
5349 |
|
|
5350 |
-- |
|
5223 | 5351 |
-- Name: plantname_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
5224 | 5352 |
-- |
5225 | 5353 |
|
schemas/vegbien_empty.sql | ||
---|---|---|
22 | 22 |
TRUNCATE method CASCADE; |
23 | 23 |
TRUNCATE methodtaxonclass CASCADE; |
24 | 24 |
TRUNCATE namedplace CASCADE; |
25 |
TRUNCATE namedplace_ancestor CASCADE; |
|
25 | 26 |
TRUNCATE namedplacecorrelation CASCADE; |
26 | 27 |
TRUNCATE note CASCADE; |
27 | 28 |
TRUNCATE notelink CASCADE; |
... | ... | |
32 | 33 |
TRUNCATE plantcorrelation CASCADE; |
33 | 34 |
TRUNCATE plantlineage CASCADE; |
34 | 35 |
TRUNCATE plantname CASCADE; |
36 |
TRUNCATE plantname_ancestor CASCADE; |
|
35 | 37 |
TRUNCATE plantnamescope CASCADE; |
36 | 38 |
TRUNCATE plantobservation CASCADE; |
37 | 39 |
TRUNCATE plantstatus CASCADE; |
schemas/vegbien.sql | ||
---|---|---|
200 | 200 |
|
201 | 201 |
|
202 | 202 |
-- |
203 |
-- Name: namedplace_update_ancestors(); Type: FUNCTION; Schema: public; Owner: - |
|
204 |
-- |
|
205 |
|
|
206 |
CREATE FUNCTION namedplace_update_ancestors() RETURNS trigger |
|
207 |
LANGUAGE plpgsql |
|
208 |
AS $$ |
|
209 |
BEGIN |
|
210 |
IF new.parent_id IS NOT NULL THEN |
|
211 |
-- Delete existing ancestors |
|
212 |
DELETE FROM namedplace_ancestor WHERE namedplace_id = new.namedplace_id; |
|
213 |
-- Copy parent's ancestors to this node's ancestors |
|
214 |
INSERT |
|
215 |
INTO namedplace_ancestor |
|
216 |
(namedplace_id, ancestor_id) |
|
217 |
SELECT |
|
218 |
new.namedplace_id, ancestor_id |
|
219 |
FROM namedplace_ancestor |
|
220 |
WHERE namedplace_id = new.parent_id |
|
221 |
; |
|
222 |
-- Add ancestor for immediate parent |
|
223 |
INSERT |
|
224 |
INTO namedplace_ancestor |
|
225 |
(namedplace_id, ancestor_id) |
|
226 |
VALUES (new.namedplace_id, new.parent_id) |
|
227 |
; |
|
228 |
-- Tell immediate children to update their ancestors lists, which will |
|
229 |
-- recursively tell all descendants |
|
230 |
UPDATE namedplace |
|
231 |
SET namedplace_id = namedplace.namedplace_id -- set to itself |
|
232 |
WHERE parent_id = namedplace_id -- the namedplace_id passed as param |
|
233 |
; |
|
234 |
/* |
|
235 |
Note: We don't need an ON DELETE trigger to update the descendants' |
|
236 |
ancestors when a node is deleted, because the |
|
237 |
namedplace.namedplace_parent_id foreign key is set to ON DELETE CASCADE, |
|
238 |
which just removes all the descendants anyway. |
|
239 |
*/ |
|
240 |
END IF; |
|
241 |
RETURN new; |
|
242 |
END; |
|
243 |
$$; |
|
244 |
|
|
245 |
|
|
246 |
-- |
|
247 |
-- Name: plantname_update_ancestors(); Type: FUNCTION; Schema: public; Owner: - |
|
248 |
-- |
|
249 |
|
|
250 |
CREATE FUNCTION plantname_update_ancestors() RETURNS trigger |
|
251 |
LANGUAGE plpgsql |
|
252 |
AS $$ |
|
253 |
BEGIN |
|
254 |
IF new.parent_id IS NOT NULL THEN |
|
255 |
-- Delete existing ancestors |
|
256 |
DELETE FROM plantname_ancestor WHERE plantname_id = new.plantname_id; |
|
257 |
-- Copy parent's ancestors to this node's ancestors |
|
258 |
INSERT |
|
259 |
INTO plantname_ancestor |
|
260 |
(plantname_id, ancestor_id) |
|
261 |
SELECT |
|
262 |
new.plantname_id, ancestor_id |
|
263 |
FROM plantname_ancestor |
|
264 |
WHERE plantname_id = new.parent_id |
|
265 |
; |
|
266 |
-- Add ancestor for immediate parent |
|
267 |
INSERT |
|
268 |
INTO plantname_ancestor |
|
269 |
(plantname_id, ancestor_id) |
|
270 |
VALUES (new.plantname_id, new.parent_id) |
|
271 |
; |
|
272 |
-- Tell immediate children to update their ancestors lists, which will |
|
273 |
-- recursively tell all descendants |
|
274 |
UPDATE plantname |
|
275 |
SET plantname_id = plantname.plantname_id -- set to itself |
|
276 |
WHERE parent_id = plantname_id -- the plantname_id passed as param |
|
277 |
; |
|
278 |
/* |
|
279 |
Note: We don't need an ON DELETE trigger to update the descendants' |
|
280 |
ancestors when a node is deleted, because the |
|
281 |
plantname.plantname_parent_id foreign key is set to ON DELETE CASCADE, |
|
282 |
which just removes all the descendants anyway. |
|
283 |
*/ |
|
284 |
END IF; |
|
285 |
RETURN new; |
|
286 |
END; |
|
287 |
$$; |
|
288 |
|
|
289 |
|
|
290 |
-- |
|
203 | 291 |
-- Name: concat(text); Type: AGGREGATE; Schema: public; Owner: - |
204 | 292 |
-- |
205 | 293 |
|
... | ... | |
1436 | 1524 |
); |
1437 | 1525 |
|
1438 | 1526 |
|
1527 |
SET default_with_oids = false; |
|
1528 |
|
|
1439 | 1529 |
-- |
1530 |
-- Name: namedplace_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1531 |
-- |
|
1532 |
|
|
1533 |
CREATE TABLE namedplace_ancestor ( |
|
1534 |
namedplace_id integer NOT NULL, |
|
1535 |
ancestor_id integer NOT NULL |
|
1536 |
); |
|
1537 |
|
|
1538 |
|
|
1539 |
-- |
|
1440 | 1540 |
-- Name: namedplace_namedplace_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
1441 | 1541 |
-- |
1442 | 1542 |
|
... | ... | |
1455 | 1555 |
ALTER SEQUENCE namedplace_namedplace_id_seq OWNED BY namedplace.namedplace_id; |
1456 | 1556 |
|
1457 | 1557 |
|
1558 |
SET default_with_oids = true; |
|
1559 |
|
|
1458 | 1560 |
-- |
1459 | 1561 |
-- Name: namedplacecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
1460 | 1562 |
-- |
... | ... | |
1773 | 1875 |
); |
1774 | 1876 |
|
1775 | 1877 |
|
1878 |
SET default_with_oids = false; |
|
1879 |
|
|
1776 | 1880 |
-- |
1881 |
-- Name: plantname_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1882 |
-- |
|
1883 |
|
|
1884 |
CREATE TABLE plantname_ancestor ( |
|
1885 |
plantname_id integer NOT NULL, |
|
1886 |
ancestor_id integer NOT NULL |
|
1887 |
); |
|
1888 |
|
|
1889 |
|
|
1890 |
-- |
|
1777 | 1891 |
-- Name: plantname_plantname_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
1778 | 1892 |
-- |
1779 | 1893 |
|
... | ... | |
1792 | 1906 |
ALTER SEQUENCE plantname_plantname_id_seq OWNED BY plantname.plantname_id; |
1793 | 1907 |
|
1794 | 1908 |
|
1795 |
SET default_with_oids = false; |
|
1796 |
|
|
1797 | 1909 |
-- |
1798 | 1910 |
-- Name: plantnamescope; Type: TABLE; Schema: public; Owner: -; Tablespace: |
1799 | 1911 |
-- |
... | ... | |
3640 | 3752 |
|
3641 | 3753 |
|
3642 | 3754 |
-- |
3755 |
-- Name: namedplace_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
3756 |
-- |
|
3757 |
|
|
3758 |
ALTER TABLE ONLY namedplace_ancestor |
|
3759 |
ADD CONSTRAINT namedplace_ancestor_pkey PRIMARY KEY (namedplace_id, ancestor_id); |
|
3760 |
|
|
3761 |
|
|
3762 |
-- |
|
3643 | 3763 |
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
3644 | 3764 |
-- |
3645 | 3765 |
|
... | ... | |
3736 | 3856 |
|
3737 | 3857 |
|
3738 | 3858 |
-- |
3859 |
-- Name: plantname_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
3860 |
-- |
|
3861 |
|
|
3862 |
ALTER TABLE ONLY plantname_ancestor |
|
3863 |
ADD CONSTRAINT plantname_ancestor_pkey PRIMARY KEY (plantname_id, ancestor_id); |
|
3864 |
|
|
3865 |
|
|
3866 |
-- |
|
3739 | 3867 |
-- Name: plantname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
3740 | 3868 |
-- |
3741 | 3869 |
|
... | ... | |
4375 | 4503 |
|
4376 | 4504 |
|
4377 | 4505 |
-- |
4506 |
-- Name: fki_namedplace_ancestor_ancestor_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4507 |
-- |
|
4508 |
|
|
4509 |
CREATE INDEX fki_namedplace_ancestor_ancestor_id ON namedplace_ancestor USING btree (ancestor_id); |
|
4510 |
|
|
4511 |
|
|
4512 |
-- |
|
4513 |
-- Name: fki_namedplace_ancestor_namedplace_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4514 |
-- |
|
4515 |
|
|
4516 |
CREATE INDEX fki_namedplace_ancestor_namedplace_id ON namedplace_ancestor USING btree (namedplace_id); |
|
4517 |
|
|
4518 |
|
|
4519 |
-- |
|
4378 | 4520 |
-- Name: fki_namedplace_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4379 | 4521 |
-- |
4380 | 4522 |
|
... | ... | |
4382 | 4524 |
|
4383 | 4525 |
|
4384 | 4526 |
-- |
4527 |
-- Name: fki_plantname_ancestor_ancestor_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4528 |
-- |
|
4529 |
|
|
4530 |
CREATE INDEX fki_plantname_ancestor_ancestor_id ON plantname_ancestor USING btree (ancestor_id); |
|
4531 |
|
|
4532 |
|
|
4533 |
-- |
|
4534 |
-- Name: fki_plantname_ancestor_plantname_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
4535 |
-- |
|
4536 |
|
|
4537 |
CREATE INDEX fki_plantname_ancestor_plantname_id ON plantname_ancestor USING btree (plantname_id); |
|
4538 |
|
|
4539 |
|
|
4540 |
-- |
|
4385 | 4541 |
-- Name: fki_plantname_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4386 | 4542 |
-- |
4387 | 4543 |
|
... | ... | |
5124 | 5280 |
|
5125 | 5281 |
|
5126 | 5282 |
-- |
5283 |
-- Name: namedplace_update_ancestors; Type: TRIGGER; Schema: public; Owner: - |
|
5284 |
-- |
|
5285 |
|
|
5286 |
CREATE TRIGGER namedplace_update_ancestors AFTER INSERT OR UPDATE ON namedplace FOR EACH ROW EXECUTE PROCEDURE namedplace_update_ancestors(); |
|
5287 |
|
|
5288 |
|
|
5289 |
-- |
|
5290 |
-- Name: plantname_update_ancestors; Type: TRIGGER; Schema: public; Owner: - |
|
5291 |
-- |
|
5292 |
|
|
5293 |
CREATE TRIGGER plantname_update_ancestors AFTER INSERT OR UPDATE ON plantname FOR EACH ROW EXECUTE PROCEDURE plantname_update_ancestors(); |
|
5294 |
|
|
5295 |
|
|
5296 |
-- |
|
5127 | 5297 |
-- Name: address_organization_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
5128 | 5298 |
-- |
5129 | 5299 |
|
... | ... | |
5572 | 5742 |
|
5573 | 5743 |
|
5574 | 5744 |
-- |
5745 |
-- Name: namedplace_ancestor_ancestor_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5746 |
-- |
|
5747 |
|
|
5748 |
ALTER TABLE ONLY namedplace_ancestor |
|
5749 |
ADD CONSTRAINT namedplace_ancestor_ancestor_id FOREIGN KEY (ancestor_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5750 |
|
|
5751 |
|
|
5752 |
-- |
|
5753 |
-- Name: namedplace_ancestor_namedplace_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5754 |
-- |
|
5755 |
|
|
5756 |
ALTER TABLE ONLY namedplace_ancestor |
|
5757 |
ADD CONSTRAINT namedplace_ancestor_namedplace_id FOREIGN KEY (namedplace_id) REFERENCES namedplace(namedplace_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5758 |
|
|
5759 |
|
|
5760 |
-- |
|
5575 | 5761 |
-- Name: namedplace_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
5576 | 5762 |
-- |
5577 | 5763 |
|
... | ... | |
5676 | 5862 |
|
5677 | 5863 |
|
5678 | 5864 |
-- |
5865 |
-- Name: plantname_ancestor_ancestor_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5866 |
-- |
|
5867 |
|
|
5868 |
ALTER TABLE ONLY plantname_ancestor |
|
5869 |
ADD CONSTRAINT plantname_ancestor_ancestor_id FOREIGN KEY (ancestor_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5870 |
|
|
5871 |
|
|
5872 |
-- |
|
5873 |
-- Name: plantname_ancestor_plantname_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5874 |
-- |
|
5875 |
|
|
5876 |
ALTER TABLE ONLY plantname_ancestor |
|
5877 |
ADD CONSTRAINT plantname_ancestor_plantname_id FOREIGN KEY (plantname_id) REFERENCES plantname(plantname_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5878 |
|
|
5879 |
|
|
5880 |
-- |
|
5679 | 5881 |
-- Name: plantname_parent_id; Type: FK CONSTRAINT; Schema: public; Owner: - |
5680 | 5882 |
-- |
5681 | 5883 |
|
Also available in: Unified diff
vegbien.sql: Added namedplace_update_ancestors and plantname_update_ancestors triggers to populate ancestor cross-links in new namedplace_ancestor and plantname_ancestor tables