26 lines
631 B
MySQL
26 lines
631 B
MySQL
|
-- Deploy camper:add_home_carousel_slide to pg
|
||
|
-- requires: roles
|
||
|
-- requires: schema_camper
|
||
|
-- requires: home_carousel
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
create or replace function add_home_carousel_slide(media_id integer, caption text) returns integer as
|
||
|
$$
|
||
|
insert into home_carousel (media_id, caption)
|
||
|
values (media_id, coalesce(caption, ''))
|
||
|
on conflict (media_id) do update
|
||
|
set caption = excluded.caption
|
||
|
returning media_id
|
||
|
;
|
||
|
$$
|
||
|
language sql
|
||
|
;
|
||
|
|
||
|
revoke execute on function add_home_carousel_slide(integer, text) from public;
|
||
|
grant execute on function add_home_carousel_slide(integer, text) to admin;
|
||
|
|
||
|
commit;
|