A small page with a brief description, carousel, and feature list of each individual accommodation. Most of the relations and functions for carousel and features are like the ones for campsite types, but i had to use the accommodation’s label to find them, because they do not have slugs; i did not even though these would be public, and they already have a label, although not unique for all companies, like UUID slugs are.
27 lines
824 B
PL/PgSQL
27 lines
824 B
PL/PgSQL
-- Deploy camper:translate_campsite to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
-- requires: campsite_i18n
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function translate_campsite(campsite_id integer, lang_tag text, info1 text, info2 text) returns void as
|
|
$$
|
|
insert into campsite_i18n (campsite_id, lang_tag, info1, info2)
|
|
values (campsite_id, lang_tag, case trim(info1) when '' then null else xmlparse(content info1) end, case trim(info2) when '' then null else xmlparse(content info2) end)
|
|
on conflict (campsite_id, lang_tag)
|
|
do update
|
|
set info1 = excluded.info1
|
|
, info2 = excluded.info2
|
|
;
|
|
$$
|
|
language sql
|
|
;
|
|
|
|
revoke execute on function translate_campsite(integer, text, text, text) from public;
|
|
grant execute on function translate_campsite(integer, text, text, text) to admin;
|
|
|
|
commit;
|