2024-02-11 20:45:00 +00:00
|
|
|
-- Deploy camper:edit_campsite_type_option to pg
|
|
|
|
-- requires: roles
|
|
|
|
-- requires: schema_camper
|
|
|
|
-- requires: campsite_type_option
|
2023-10-06 11:26:01 +00:00
|
|
|
|
|
|
|
begin;
|
|
|
|
|
2024-02-11 20:45:00 +00:00
|
|
|
set search_path to camper, public;
|
|
|
|
|
|
|
|
drop function if exists edit_campsite_type_option(integer, text, integer, integer, boolean);
|
|
|
|
|
|
|
|
create or replace function edit_campsite_type_option(option_id integer, name text, min integer, max integer) returns integer as
|
|
|
|
$$
|
|
|
|
update campsite_type_option
|
|
|
|
set name = edit_campsite_type_option.name
|
|
|
|
, range = int4range(min, max, '[]')
|
|
|
|
where campsite_type_option_id = option_id
|
|
|
|
returning campsite_type_option_id
|
|
|
|
;
|
|
|
|
$$
|
|
|
|
language sql
|
|
|
|
;
|
|
|
|
|
|
|
|
revoke execute on function edit_campsite_type_option(integer, text, integer, integer) from public;
|
|
|
|
grant execute on function edit_campsite_type_option(integer, text, integer, integer) to admin;
|
2023-10-06 11:26:01 +00:00
|
|
|
|
|
|
|
commit;
|