-- Deploy camper:translate_services_carousel_slide to pg
-- requires: roles
-- requires: schema_camper
-- requires: services_carousel_i18n

begin;

set search_path to camper, public;

create or replace function translate_services_carousel_slide(media_id integer, lang_tag text, caption text) returns void as
$$
	insert into services_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_services_carousel_slide(integer, text, text) from public;
grant execute on function translate_services_carousel_slide(integer, text, text) to admin;

commit;