-- 会话摘要持久化
CREATE TABLE IF NOT EXISTS session_summaries (
    id SERIAL PRIMARY KEY,
    user_id TEXT NOT NULL DEFAULT 'default',
    summary_text TEXT NOT NULL,
    reason TEXT NOT NULL DEFAULT 'overflow',
    message_count INTEGER NOT NULL DEFAULT 0,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_session_summaries_created
    ON session_summaries (created_at DESC);
