-- Deploy camper:edit_service to pg
-- requires: roles
-- requires: schema_camper
-- requires: service

begin;

set search_path to camper, public;

create or replace function edit_service(service_id integer, icon_name text, name text, description text) returns void as
$$
	update service
	set icon_name = edit_service.icon_name
	  , name = edit_service.name
	  , description = xmlparse(content edit_service.description)
	where service_id = edit_service.service_id
	;
$$
	language sql
;

revoke execute on function edit_service(integer, text, text, text) from public;
grant execute on function edit_service(integer, text, text, text) to admin;

commit;
