Revision 12584
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/vegbien.my.sql | ||
---|---|---|
779 | 779 |
|
780 | 780 |
|
781 | 781 |
-- |
782 |
-- Name: locationevent_set_place_visit_id(); Type: FUNCTION; Schema: public; Owner: - |
|
783 |
-- |
|
784 |
|
|
785 |
|
|
786 |
|
|
787 |
|
|
788 |
-- |
|
782 | 789 |
-- Name: locationplace__set_location_current_place(); Type: FUNCTION; Schema: public; Owner: - |
783 | 790 |
-- |
784 | 791 |
|
... | ... | |
2162 | 2169 |
source_id int(11) NOT NULL, |
2163 | 2170 |
sourceaccessioncode varchar(255), |
2164 | 2171 |
accesslevel varchar(255), |
2172 |
place_visit_id int(11) NOT NULL, |
|
2165 | 2173 |
parent_id int(11), |
2166 | 2174 |
location_id int(11), |
2167 | 2175 |
project_id int(11), |
... | ... | |
9326 | 9334 |
|
9327 | 9335 |
|
9328 | 9336 |
-- |
9337 |
-- Name: locationevent_set_place_visit_id; Type: TRIGGER; Schema: public; Owner: - |
|
9338 |
-- |
|
9339 |
|
|
9340 |
|
|
9341 |
|
|
9342 |
|
|
9343 |
-- |
|
9329 | 9344 |
-- Name: locationplace__set_location_current_place; Type: TRIGGER; Schema: public; Owner: - |
9330 | 9345 |
-- |
9331 | 9346 |
|
trunk/schemas/vegbien.sql | ||
---|---|---|
1412 | 1412 |
|
1413 | 1413 |
|
1414 | 1414 |
-- |
1415 |
-- Name: locationevent_set_place_visit_id(); Type: FUNCTION; Schema: public; Owner: - |
|
1416 |
-- |
|
1417 |
|
|
1418 |
CREATE FUNCTION locationevent_set_place_visit_id() RETURNS trigger |
|
1419 |
LANGUAGE plpgsql |
|
1420 |
AS $$ |
|
1421 |
BEGIN |
|
1422 |
new.place_visit_id = (CASE WHEN new.parent_id IS NULL |
|
1423 |
THEN new.locationevent_id |
|
1424 |
ELSE (SELECT place_visit_id FROM locationevent WHERE locationevent_id = new.parent_id) |
|
1425 |
END); |
|
1426 |
RETURN new; |
|
1427 |
END; |
|
1428 |
$$; |
|
1429 |
|
|
1430 |
|
|
1431 |
-- |
|
1415 | 1432 |
-- Name: locationplace__set_location_current_place(); Type: FUNCTION; Schema: public; Owner: - |
1416 | 1433 |
-- |
1417 | 1434 |
|
... | ... | |
3972 | 3989 |
source_id integer NOT NULL, |
3973 | 3990 |
sourceaccessioncode text, |
3974 | 3991 |
accesslevel accesslevel, |
3992 |
place_visit_id integer NOT NULL, |
|
3975 | 3993 |
parent_id integer, |
3976 | 3994 |
location_id integer, |
3977 | 3995 |
project_id integer, |
... | ... | |
12085 | 12103 |
|
12086 | 12104 |
|
12087 | 12105 |
-- |
12106 |
-- Name: locationevent_set_place_visit_id; Type: TRIGGER; Schema: public; Owner: - |
|
12107 |
-- |
|
12108 |
|
|
12109 |
CREATE TRIGGER locationevent_set_place_visit_id BEFORE INSERT OR UPDATE OF locationevent_id, place_visit_id, parent_id ON locationevent FOR EACH ROW EXECUTE PROCEDURE locationevent_set_place_visit_id(); |
|
12110 |
|
|
12111 |
|
|
12112 |
-- |
|
12088 | 12113 |
-- Name: locationplace__set_location_current_place; Type: TRIGGER; Schema: public; Owner: - |
12089 | 12114 |
-- |
12090 | 12115 |
|
Also available in: Unified diff
schemas/vegbien.sql: locationevent: added locationevent_set_place_visit_id() trigger, analogous to location_set_plot_location_id() but for the locationevent nesting hierarchy. this is needed by the SALVIAS validation queries.