29 lines
1.6 KiB
PL/PgSQL
29 lines
1.6 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
|
|
-- 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);
|
|
|
|
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, 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, dogs_allowed, 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, dogs_allowed, 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, boolean, boolean, boolean) from public;
|
|
grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean) to admin;
|
|
|
|
commit;
|