camper/revert/add_campsite_type@v3.sql

27 lines
1.3 KiB
PL/PgSQL

-- Deploy camper:add_campsite_type to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: company
-- requires: campsite_type__check_in_out
begin;
set search_path to camper, public;
drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean);
create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean) returns uuid as
$$
insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, dogs_allowed)
values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, dogs_allowed)
returning slug;
$$
language sql
;
revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) from public;
grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean) to admin;
commit;