-- Deploy camper:add_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 add_campsite_type(company integer, name text, description text) returns uuid as
$$
	insert into campsite_type (company_id, name, description)
	values (company, name, xmlparse (content description))
	returning slug;
$$
	language sql
;

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

commit;
