-- Deploy camper:edit_campsite_type to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: company

begin;

set search_path to camper, public;

create or replace function edit_campsite_type(slug uuid, name text, description text, active boolean) returns uuid as
$$
	update campsite_type
	set name = edit_campsite_type.name
	  , description = xmlparse(content edit_campsite_type.description)
	  , active = edit_campsite_type.active
	where slug = edit_campsite_type.slug
	returning slug;
$$
language sql
;

revoke execute on function edit_campsite_type(uuid, text, text, boolean) from public;
grant execute on function edit_campsite_type(uuid, text, text, boolean) to admin;

commit;
