-- ============================================================
-- Cielo user-state table — run once in the Supabase SQL editor
-- Tracks one-time flags per user (e.g. "has Cielo already asked about Italian?")
-- ============================================================

CREATE TABLE IF NOT EXISTS cielo_user_state (
    user_id       TEXT PRIMARY KEY,
    asked_italian BOOLEAN DEFAULT FALSE,
    updated_at    TIMESTAMPTZ DEFAULT now()
);

ALTER TABLE cielo_user_state ENABLE ROW LEVEL SECURITY;

CREATE POLICY "service_role_all_cielo_state" ON cielo_user_state
    FOR ALL TO service_role USING (true) WITH CHECK (true);
