camper/deploy/translate_home.sql

26 lines
625 B
MySQL
Raw Normal View History

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