-- ================================================================ -- WEBSITE CMS – Vollständige Migration (konsolidiert) -- Alle Tabellen, Spalten und RLS-Policies in einer Datei. -- Im Supabase SQL-Editor einmalig ausführen. -- ================================================================ -- ── Hero Section ───────────────────────────────────────────────── CREATE TABLE IF NOT EXISTS hero_content ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), -- Site / Navbar site_name text NOT NULL DEFAULT 'Musterfirma', site_tagline text NOT NULL DEFAULT '', logo_path text DEFAULT NULL, -- Storage: site-assets favicon_path text DEFAULT NULL, -- Storage: site-assets -- Hero-Texte eyebrow_text text NOT NULL DEFAULT 'Ihr Slogan hier', headline1 text NOT NULL DEFAULT 'Wir lieben Qualität.', headline2 text NOT NULL DEFAULT 'Ihre Kunden auch.', subtext1 text NOT NULL DEFAULT '', subtext2 text NOT NULL DEFAULT '', -- Buttons cta1_text text NOT NULL DEFAULT 'Jetzt anfragen', cta1_href text NOT NULL DEFAULT '#kontakt', cta2_text text NOT NULL DEFAULT 'Unsere Leistungen', cta2_href text NOT NULL DEFAULT '#leistungen', -- Hintergrundbild bg_image_path text DEFAULT NULL, -- Storage: hero-bilder updated_at timestamptz NOT NULL DEFAULT now() ); CREATE TABLE IF NOT EXISTS hero_badges ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), text text NOT NULL, reihenfolge int NOT NULL DEFAULT 0 ); -- ── Über uns / About ───────────────────────────────────────────── CREATE TABLE IF NOT EXISTS ueber_uns_content ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), eyebrow_text text NOT NULL DEFAULT 'Klein, aber fein', absatz1 text NOT NULL DEFAULT '', absatz2 text NOT NULL DEFAULT '', bild_url text DEFAULT NULL, updated_at timestamptz NOT NULL DEFAULT now() ); CREATE TABLE IF NOT EXISTS ueber_uns_stats ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), wert text NOT NULL, label text NOT NULL, reihenfolge int NOT NULL DEFAULT 0 ); -- ── Galerie ────────────────────────────────────────────────────── CREATE TABLE IF NOT EXISTS galerie_bilder ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), storage_path text NOT NULL, -- Storage: galerie-bilder alt_text text NOT NULL DEFAULT '', reihenfolge int NOT NULL DEFAULT 0 ); -- ── Kontakt ────────────────────────────────────────────────────── CREATE TABLE IF NOT EXISTS kontakt_info ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), telefon text NOT NULL DEFAULT '', email text NOT NULL DEFAULT '', adresse_zeile1 text NOT NULL DEFAULT '', adresse_zeile2 text NOT NULL DEFAULT '', formular_empfaenger text NOT NULL DEFAULT '', updated_at timestamptz NOT NULL DEFAULT now() ); CREATE TABLE IF NOT EXISTS kontakt_oeffnungszeiten ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), tag text NOT NULL, von text NOT NULL, bis text NOT NULL, reihenfolge int NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS kontakt_social ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), platform text NOT NULL, url text NOT NULL, reihenfolge int NOT NULL DEFAULT 0 ); -- ── RLS: Öffentliche Leseberechtigung (Anon-Key) ───────────────── ALTER TABLE hero_content ENABLE ROW LEVEL SECURITY; ALTER TABLE hero_badges ENABLE ROW LEVEL SECURITY; ALTER TABLE ueber_uns_content ENABLE ROW LEVEL SECURITY; ALTER TABLE ueber_uns_stats ENABLE ROW LEVEL SECURITY; ALTER TABLE galerie_bilder ENABLE ROW LEVEL SECURITY; ALTER TABLE kontakt_info ENABLE ROW LEVEL SECURITY; ALTER TABLE kontakt_oeffnungszeiten ENABLE ROW LEVEL SECURITY; ALTER TABLE kontakt_social ENABLE ROW LEVEL SECURITY; DROP POLICY IF EXISTS "public read" ON hero_content; DROP POLICY IF EXISTS "public read" ON hero_badges; DROP POLICY IF EXISTS "public read" ON ueber_uns_content; DROP POLICY IF EXISTS "public read" ON ueber_uns_stats; DROP POLICY IF EXISTS "public read" ON galerie_bilder; DROP POLICY IF EXISTS "public read" ON kontakt_info; DROP POLICY IF EXISTS "public read" ON kontakt_oeffnungszeiten; DROP POLICY IF EXISTS "public read" ON kontakt_social; CREATE POLICY "public read" ON hero_content FOR SELECT TO public USING (true); CREATE POLICY "public read" ON hero_badges FOR SELECT TO public USING (true); CREATE POLICY "public read" ON ueber_uns_content FOR SELECT TO public USING (true); CREATE POLICY "public read" ON ueber_uns_stats FOR SELECT TO public USING (true); CREATE POLICY "public read" ON galerie_bilder FOR SELECT TO public USING (true); CREATE POLICY "public read" ON kontakt_info FOR SELECT TO public USING (true); CREATE POLICY "public read" ON kontakt_oeffnungszeiten FOR SELECT TO public USING (true); CREATE POLICY "public read" ON kontakt_social FOR SELECT TO public USING (true);