Revision 5550
Added by Aaron Marcuse-Kubitza over 12 years ago
tree_cross-links.sql | ||
---|---|---|
3 | 3 |
|
4 | 4 |
----- Functions |
5 | 5 |
|
6 |
-- Function: taxonconcept_update_ancestors(taxonconcept, integer) |
|
7 |
|
|
8 |
-- DROP FUNCTION taxonconcept_update_ancestors(taxonconcept, integer); |
|
9 |
|
|
10 | 6 |
CREATE OR REPLACE FUNCTION taxonconcept_update_ancestors(new taxonconcept, old_parent_id integer DEFAULT NULL::integer) |
11 | 7 |
RETURNS void AS |
12 | 8 |
$BODY$ |
... | ... | |
55 | 51 |
$BODY$ |
56 | 52 |
LANGUAGE plpgsql VOLATILE |
57 | 53 |
COST 100; |
58 |
ALTER FUNCTION taxonconcept_update_ancestors(taxonconcept, integer) |
|
59 |
OWNER TO bien; |
|
60 | 54 |
|
61 |
-- Function: taxonconcept_update_ancestors_on_insert() |
|
62 |
|
|
63 |
-- DROP FUNCTION taxonconcept_update_ancestors_on_insert(); |
|
64 |
|
|
65 | 55 |
CREATE OR REPLACE FUNCTION taxonconcept_update_ancestors_on_insert() |
66 | 56 |
RETURNS trigger AS |
67 | 57 |
$BODY$ |
... | ... | |
82 | 72 |
$BODY$ |
83 | 73 |
LANGUAGE plpgsql VOLATILE |
84 | 74 |
COST 100; |
85 |
ALTER FUNCTION taxonconcept_update_ancestors_on_insert() |
|
86 |
OWNER TO bien; |
|
87 | 75 |
|
88 |
-- Function: taxonconcept_update_ancestors_on_update() |
|
89 |
|
|
90 |
-- DROP FUNCTION taxonconcept_update_ancestors_on_update(); |
|
91 |
|
|
92 | 76 |
CREATE OR REPLACE FUNCTION taxonconcept_update_ancestors_on_update() |
93 | 77 |
RETURNS trigger AS |
94 | 78 |
$BODY$ |
... | ... | |
101 | 85 |
$BODY$ |
102 | 86 |
LANGUAGE plpgsql VOLATILE |
103 | 87 |
COST 100; |
104 |
ALTER FUNCTION taxonconcept_update_ancestors_on_update() |
|
105 |
OWNER TO bien; |
|
106 | 88 |
|
107 | 89 |
----- Ancestors table |
108 | 90 |
|
109 |
-- Table: taxonconcept_ancestor |
|
110 |
|
|
111 |
-- DROP TABLE taxonconcept_ancestor; |
|
112 |
|
|
113 | 91 |
CREATE TABLE taxonconcept_ancestor |
114 | 92 |
( |
115 | 93 |
taxonconcept_id integer NOT NULL, |
... | ... | |
125 | 103 |
WITH ( |
126 | 104 |
OIDS=FALSE |
127 | 105 |
); |
128 |
ALTER TABLE taxonconcept_ancestor |
|
129 |
OWNER TO bien; |
|
130 | 106 |
COMMENT ON TABLE taxonconcept_ancestor |
131 | 107 |
IS 'Stores the accepted ancestors of a taxonconcept. Auto-populated, so should not be manually modified.'; |
132 | 108 |
|
133 |
-- Index: taxonconcept_ancestor_descendants |
|
134 |
|
|
135 |
-- DROP INDEX taxonconcept_ancestor_descendants; |
|
136 |
|
|
137 | 109 |
CREATE INDEX taxonconcept_ancestor_descendants |
138 | 110 |
ON taxonconcept_ancestor |
139 | 111 |
USING btree |
140 | 112 |
(ancestor_id , taxonconcept_id ); |
141 | 113 |
|
142 |
|
|
143 | 114 |
----- Triggers |
144 | 115 |
|
145 |
-- Trigger: taxonconcept_update_ancestors_on_insert on taxonconcept |
|
146 |
|
|
147 |
-- DROP TRIGGER taxonconcept_update_ancestors_on_insert ON taxonconcept; |
|
148 |
|
|
149 | 116 |
CREATE TRIGGER taxonconcept_update_ancestors_on_insert |
150 | 117 |
AFTER INSERT |
151 | 118 |
ON taxonconcept |
152 | 119 |
FOR EACH ROW |
153 | 120 |
EXECUTE PROCEDURE taxonconcept_update_ancestors_on_insert(); |
154 | 121 |
|
155 |
-- Trigger: taxonconcept_update_ancestors_on_update on taxonconcept |
|
156 |
|
|
157 |
-- DROP TRIGGER taxonconcept_update_ancestors_on_update ON taxonconcept; |
|
158 |
|
|
159 | 122 |
CREATE TRIGGER taxonconcept_update_ancestors_on_update |
160 | 123 |
AFTER UPDATE |
161 | 124 |
ON taxonconcept |
Also available in: Unified diff
schemas/tree_cross-links.sql: Removed header comments added by pgAdmin