camper/deploy/add_campsite_type.sql

29 lines
1.6 KiB
MySQL
Raw Permalink Normal View History

-- Deploy camper:add_campsite_type to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: company
-- requires: campsite_type__check_in_out
-- requires: campsite_type__overflow_allowed
-- requires: campsite_type__ask_zone_preferences
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, bookable_nights int4range, overflow_allowed boolean, ask_zone_preferences 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, bookable_nights, overflow_allowed, ask_zone_preferences)
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, bookable_nights, overflow_allowed, ask_zone_preferences)
returning slug;
$$
language sql
;
revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean) from public;
grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean) to admin;
commit;