-- ai_brain base schema
-- Date: 10.mar.2026
--
-- Prerequisites:
--   CREATE EXTENSION IF NOT EXISTS pgcrypto;
--   CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
--   CREATE EXTENSION IF NOT EXISTS vector;
--
-- Apply this first, then clawdie-brain-hybrid-upgrade.sql

CREATE TABLE IF NOT EXISTS memories (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    created_at TIMESTAMPTZ DEFAULT NOW(),
    session_id TEXT,
    importance INTEGER DEFAULT 2,
    summary TEXT NOT NULL,
    topics TEXT[] DEFAULT '{}',
    key_facts TEXT[] DEFAULT '{}',
    decisions TEXT[] DEFAULT '{}',
    first_message TEXT,
    message_count INTEGER DEFAULT 0
);
