-- ============================================================ -- Schopenhauer character — Supabase setup -- Run this once in the Supabase SQL editor -- ============================================================ -- Dialogues table (mirrors 01S_socratic_dialogues exactly) CREATE TABLE IF NOT EXISTS "01SCH_socratic_dialogues" ( dialogue_id TEXT PRIMARY KEY, user_id TEXT NOT NULL, started_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ, date_closed TIMESTAMPTZ, date_opened TIMESTAMPTZ, status TEXT DEFAULT 'B', socratic_topic TEXT, key_question TEXT, summary TEXT, closing_position TEXT, dialogue_narrative TEXT, relevant_attitude_axes JSONB, relevant_ethical_axes JSONB, possible_contradictions JSONB, possible_dilemmas JSONB, ready_to_confront BOOLEAN DEFAULT FALSE, confront_reason TEXT, closing_mode TEXT, pending_topic TEXT, session_id INTEGER ); -- Index for fast per-user lookups CREATE INDEX IF NOT EXISTS idx_01sch_dialogues_user_id ON "01SCH_socratic_dialogues" (user_id); -- Enable Row Level Security (match 01S_ policy) ALTER TABLE "01SCH_socratic_dialogues" ENABLE ROW LEVEL SECURITY; -- Allow service role full access (same as other dialogue tables) CREATE POLICY "service_role_all_01SCH" ON "01SCH_socratic_dialogues" FOR ALL TO service_role USING (true) WITH CHECK (true);