File size: 1,597 Bytes
b670368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- ============================================================
-- 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);