camper/deploy/translate_cover_carousel_sl...

24 lines
703 B
MySQL
Raw Normal View History

-- Deploy camper:translate_cover_carousel_slide to pg
-- requires: roles
-- requires: schema_camper
-- requires: cover_carousel_i18n
begin;
set search_path to camper, public;
create or replace function translate_cover_carousel_slide (media_id integer, lang_tag text, caption text) returns void as
$$
insert into cover_carousel_i18n (media_id, lang_tag, caption)
values (media_id, lang_tag, coalesce(caption, ''))
on conflict (media_id, lang_tag) do update
set caption = excluded.caption
$$
language sql
;
revoke execute on function translate_cover_carousel_slide(integer, text, text) from public;
grant execute on function translate_cover_carousel_slide(integer, text, text) to admin;
commit;