28 lines
695 B
MySQL
28 lines
695 B
MySQL
|
-- Deploy camper:translate_season to pg
|
||
|
-- requires: roles
|
||
|
-- requires: schema_camper
|
||
|
-- requires: season
|
||
|
-- requires: season_i18n
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
create or replace function translate_season(slug uuid, lang_tag text, name text) returns void as
|
||
|
$$
|
||
|
insert into season_i18n (season_id, lang_tag, name)
|
||
|
select season_id, translate_season.lang_tag, translate_season.name
|
||
|
from season
|
||
|
where slug = translate_season.slug
|
||
|
on conflict (season_id, lang_tag) do update
|
||
|
set name = excluded.name
|
||
|
;
|
||
|
$$
|
||
|
language sql
|
||
|
;
|
||
|
|
||
|
revoke execute on function translate_season(uuid, text, text) from public;
|
||
|
grant execute on function translate_season(uuid, text, text) to admin;
|
||
|
|
||
|
commit;
|