CREATE TABLE IF NOT EXISTS library_threads (
  id TEXT PRIMARY KEY,
  user_id TEXT NOT NULL,
  title TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT NOW() NOT NULL,
  sources JSONB DEFAULT '[]',
  files JSONB DEFAULT '[]'
);
