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:
2026-07-18 02:08:01 +02:00
parent 33909c660b
commit 1cc19de221
4 changed files with 220 additions and 67 deletions
+62 -4
View File
@@ -22,6 +22,9 @@ SET row_security = off;
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--
-- Das "public"-Schema existiert im offiziellen postgres-Image bereits;
-- CREATE SCHEMA würde dort mit ON_ERROR_STOP=1 das komplette Init-Skript
-- abbrechen.
CREATE SCHEMA IF NOT EXISTS public;
@@ -106,7 +109,9 @@ SET default_table_access_method = heap;
CREATE TABLE public.additives (
code text NOT NULL,
name text NOT NULL,
sort integer DEFAULT 0 NOT NULL
sort integer DEFAULT 0 NOT NULL,
name_en text,
name_pl text
);
@@ -117,7 +122,21 @@ CREATE TABLE public.additives (
CREATE TABLE public.allergens (
code text NOT NULL,
name text NOT NULL,
sort integer DEFAULT 0 NOT NULL
sort integer DEFAULT 0 NOT NULL,
name_en text,
name_pl text
);
--
-- Name: dish_suggestions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.dish_suggestions (
id uuid DEFAULT gen_random_uuid() NOT NULL,
name text NOT NULL,
description text,
created_at timestamp with time zone DEFAULT now() NOT NULL
);
@@ -132,7 +151,9 @@ CREATE TABLE public.dishes (
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
allergens text[] DEFAULT '{}'::text[] NOT NULL,
additives text[] DEFAULT '{}'::text[] NOT NULL
additives text[] DEFAULT '{}'::text[] NOT NULL,
name_en text,
name_pl text
);
@@ -173,7 +194,9 @@ CREATE TABLE public.sections (
key text NOT NULL,
label text NOT NULL,
time_range text NOT NULL,
sort integer NOT NULL
sort integer NOT NULL,
label_en text,
label_pl text
);
@@ -207,6 +230,14 @@ ALTER TABLE ONLY public.allergens
ADD CONSTRAINT allergens_pkey PRIMARY KEY (code);
--
-- Name: dish_suggestions dish_suggestions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.dish_suggestions
ADD CONSTRAINT dish_suggestions_pkey PRIMARY KEY (id);
--
-- Name: dishes dishes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -340,6 +371,33 @@ CREATE POLICY allergens_public_read ON public.allergens FOR SELECT TO authentica
CREATE POLICY allergens_staff_write ON public.allergens TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text]))) WITH CHECK ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text])));
--
-- Name: dish_suggestions; Type: ROW SECURITY; Schema: public; Owner: -
--
ALTER TABLE public.dish_suggestions ENABLE ROW LEVEL SECURITY;
--
-- Name: dish_suggestions dish_suggestions_public_insert; Type: POLICY; Schema: public; Owner: -
--
CREATE POLICY dish_suggestions_public_insert ON public.dish_suggestions FOR INSERT TO authenticated, anon WITH CHECK (true);
--
-- Name: dish_suggestions dish_suggestions_staff_delete; Type: POLICY; Schema: public; Owner: -
--
CREATE POLICY dish_suggestions_staff_delete ON public.dish_suggestions FOR DELETE TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text])));
--
-- Name: dish_suggestions dish_suggestions_staff_select; Type: POLICY; Schema: public; Owner: -
--
CREATE POLICY dish_suggestions_staff_select ON public.dish_suggestions FOR SELECT TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text])));
--
-- Name: dishes; Type: ROW SECURITY; Schema: public; Owner: -
--