Migration: Übersetzungsspalten für Inhalte + Rezeptvorschläge-Tabelle
dishes/sections/allergens/additives bekommen _en/_pl-Spalten; die 14 EU-Allergene, 11 Zusatzstoff-Kennzeichnungen und 4 Bereiche sind direkt mit Referenz-Übersetzungen befüllt. localized() liefert den Text zur aktuellen Sprache mit Fallback auf Deutsch. Neue Tabelle dish_suggestions (RLS: jeder darf einreichen, nur Staff/Admin lesen). Lokale PostgreSQL-Kopie auf den neuen Stand gebracht.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
-- =============================================================
|
||||
-- Mehrsprachigkeit (Inhalte) + Rezeptvorschläge
|
||||
-- =============================================================
|
||||
|
||||
-- ---------- Übersetzungsspalten ----------
|
||||
-- Nullable: ohne Übersetzung fällt die Anzeige auf den deutschen
|
||||
-- Text zurück. Werden manuell oder per DeepL-Anbindung befüllt.
|
||||
alter table public.dishes add column name_en text, add column name_pl text;
|
||||
alter table public.sections add column label_en text, add column label_pl text;
|
||||
alter table public.allergens add column name_en text, add column name_pl text;
|
||||
alter table public.additives add column name_en text, add column name_pl text;
|
||||
|
||||
-- ---------- Referenz-Übersetzungen (feste EU-Kennzeichnung) ----------
|
||||
update public.sections set label_en = 'Breakfast', label_pl = 'Śniadanie' where key = 'brotzeit';
|
||||
update public.sections set label_en = 'Lunch', label_pl = 'Obiad' where key = 'mittagessen';
|
||||
update public.sections set label_en = 'Lunch (vegetarian)', label_pl = 'Obiad (wegetariański)' where key = 'mittagessen_veg';
|
||||
update public.sections set label_en = 'Soup', label_pl = 'Zupa' where key = 'suppe';
|
||||
|
||||
update public.allergens set name_en = 'Cereals containing gluten', name_pl = 'Zboża zawierające gluten' where code = 'A';
|
||||
update public.allergens set name_en = 'Crustaceans', name_pl = 'Skorupiaki' where code = 'B';
|
||||
update public.allergens set name_en = 'Eggs', name_pl = 'Jaja' where code = 'C';
|
||||
update public.allergens set name_en = 'Fish', name_pl = 'Ryby' where code = 'D';
|
||||
update public.allergens set name_en = 'Peanuts', name_pl = 'Orzeszki ziemne' where code = 'E';
|
||||
update public.allergens set name_en = 'Soybeans', name_pl = 'Soja' where code = 'F';
|
||||
update public.allergens set name_en = 'Milk (including lactose)', name_pl = 'Mleko (w tym laktoza)' where code = 'G';
|
||||
update public.allergens set name_en = 'Tree nuts', name_pl = 'Orzechy' where code = 'H';
|
||||
update public.allergens set name_en = 'Celery', name_pl = 'Seler' where code = 'I';
|
||||
update public.allergens set name_en = 'Mustard', name_pl = 'Gorczyca' where code = 'J';
|
||||
update public.allergens set name_en = 'Sesame seeds', name_pl = 'Nasiona sezamu' where code = 'K';
|
||||
update public.allergens set name_en = 'Sulphur dioxide and sulphites', name_pl = 'Dwutlenek siarki i siarczyny' where code = 'L';
|
||||
update public.allergens set name_en = 'Lupin', name_pl = 'Łubin' where code = 'M';
|
||||
update public.allergens set name_en = 'Molluscs', name_pl = 'Mięczaki' where code = 'N';
|
||||
|
||||
update public.additives set name_en = 'with colouring', name_pl = 'z barwnikiem' where code = '1';
|
||||
update public.additives set name_en = 'with preservative', name_pl = 'z konserwantem' where code = '2';
|
||||
update public.additives set name_en = 'with antioxidant', name_pl = 'z przeciwutleniaczem' where code = '3';
|
||||
update public.additives set name_en = 'with flavour enhancer', name_pl = 'ze wzmacniaczem smaku' where code = '4';
|
||||
update public.additives set name_en = 'sulphured', name_pl = 'siarkowany' where code = '5';
|
||||
update public.additives set name_en = 'blackened', name_pl = 'barwiony na czarno' where code = '6';
|
||||
update public.additives set name_en = 'waxed', name_pl = 'woskowany' where code = '7';
|
||||
update public.additives set name_en = 'with phosphate', name_pl = 'z fosforanem' where code = '8';
|
||||
update public.additives set name_en = 'with sweetener(s)', name_pl = 'ze słodzikiem/słodzikami' where code = '9';
|
||||
update public.additives set name_en = 'contains a source of phenylalanine', name_pl = 'zawiera źródło fenyloalaniny' where code = '10';
|
||||
update public.additives set name_en = 'caffeinated', name_pl = 'zawiera kofeinę' where code = '11';
|
||||
|
||||
-- ---------- Rezeptvorschläge ----------
|
||||
create table public.dish_suggestions (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
name text not null,
|
||||
description text,
|
||||
created_at timestamptz not null default now()
|
||||
);
|
||||
|
||||
alter table public.dish_suggestions enable row level security;
|
||||
|
||||
-- Jeder darf einen Vorschlag einreichen, aber niemand außer dem
|
||||
-- Kantinen-Team darf die Liste einsehen (kein Lesezugriff für anon).
|
||||
create policy "dish_suggestions_public_insert" on public.dish_suggestions
|
||||
for insert to anon, authenticated
|
||||
with check (true);
|
||||
|
||||
create policy "dish_suggestions_staff_select" on public.dish_suggestions
|
||||
for select to authenticated
|
||||
using (public.app_role() in ('staff', 'admin'));
|
||||
|
||||
create policy "dish_suggestions_staff_delete" on public.dish_suggestions
|
||||
for delete to authenticated
|
||||
using (public.app_role() in ('staff', 'admin'));
|
||||
Reference in New Issue
Block a user