26 lines
700 B
MySQL
26 lines
700 B
MySQL
|
-- Deploy camper:edit_campsite to pg
|
||
|
-- requires: roles
|
||
|
-- requires: schema_camper
|
||
|
-- requires: campsite
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
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;
|
||
|
|
||
|
commit;
|