2024-01-26 21:27:54 +00:00
|
|
|
-- Deploy camper:edit_campsite to pg
|
|
|
|
-- requires: roles
|
|
|
|
-- requires: schema_camper
|
|
|
|
-- requires: campsite
|
2023-08-14 18:18:26 +00:00
|
|
|
|
|
|
|
begin;
|
|
|
|
|
2024-01-26 21:27:54 +00:00
|
|
|
set search_path to camper, public;
|
|
|
|
|
|
|
|
drop function if exists edit_campsite(integer, integer, text, text, text, boolean);
|
|
|
|
|
|
|
|
create or replace function edit_campsite(campsite_id integer, campsite_type integer, new_label text, active boolean) returns integer as
|
|
|
|
$$
|
|
|
|
update campsite
|
|
|
|
set label = edit_campsite.new_label
|
|
|
|
, campsite_type_id = edit_campsite.campsite_type
|
|
|
|
, active = edit_campsite.active
|
|
|
|
where campsite_id = edit_campsite.campsite_id
|
|
|
|
returning campsite_id;
|
|
|
|
$$
|
|
|
|
language sql
|
|
|
|
;
|
|
|
|
|
|
|
|
revoke execute on function edit_campsite(integer, integer, text, boolean) from public;
|
|
|
|
grant execute on function edit_campsite(integer, integer, text, boolean) to admin;
|
2023-08-14 18:18:26 +00:00
|
|
|
|
|
|
|
commit;
|