27 lines
761 B
MySQL
27 lines
761 B
MySQL
|
-- Deploy camper:add_campsite_type_feature to pg
|
||
|
-- requires: roles
|
||
|
-- requires: schema_camper
|
||
|
-- requires: campsite_type_feature
|
||
|
-- requires: campsite_type
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
create or replace function add_campsite_type_feature(type_slug uuid, icon_name text, name text) returns integer as
|
||
|
$$
|
||
|
insert into campsite_type_feature (campsite_type_id, icon_name, name)
|
||
|
select campsite_type_id, add_campsite_type_feature.icon_name, add_campsite_type_feature.name
|
||
|
from campsite_type
|
||
|
where slug = type_slug
|
||
|
returning campsite_type_feature_id
|
||
|
;
|
||
|
$$
|
||
|
language sql
|
||
|
;
|
||
|
|
||
|
revoke execute on function add_campsite_type_feature(uuid, text, text) from public;
|
||
|
grant execute on function add_campsite_type_feature(uuid, text, text) to admin;
|
||
|
|
||
|
commit;
|