-- Deploy camper:translate_campsite_type_option to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type_option_i18n

begin;

set search_path to camper, public;

create or replace function translate_campsite_type_option(option_id integer, lang_tag text, name text) returns void as
$$
	insert into campsite_type_option_i18n (campsite_type_option_id, lang_tag, name)
	values (option_id, lang_tag, name)
	on conflict (campsite_type_option_id, lang_tag) do update
	set name = excluded.name
	;
$$
	language sql
;

revoke execute on function translate_campsite_type_option(integer, text, text) from public;
grant execute on function translate_campsite_type_option(integer, text, text) to admin;

commit;
