-- Deploy camper:edit_page to pg
-- requires: roles
-- requires: schema_camper
-- requires: page

begin;

set search_path to camper, public;

create or replace function edit_page(slug uuid, title text, content text) returns uuid as
$$
	update page
	set title = edit_page.title
	  , content = xmlparse(content edit_page.content)
	where slug = edit_page.slug
	returning slug;
$$
	language sql
;

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

commit;
