26 lines
637 B
PL/PgSQL
26 lines
637 B
PL/PgSQL
-- Deploy camper:add_cover_carousel_slide to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
-- requires: cover_carousel
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function add_cover_carousel_slide(media_id integer, caption text) returns integer as
|
|
$$
|
|
insert into cover_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_cover_carousel_slide(integer, text) from public;
|
|
grant execute on function add_cover_carousel_slide(integer, text) to admin;
|
|
|
|
commit;
|