DROP TABLE IF EXISTS user;
CREATE TABLE user (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  username TEXT UNIQUE NOT NULL,
  passhash TEXT NOT NULL
);

DROP TABLE IF EXISTS ai;
CREATE TABLE ai (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  input_keys TEXT NOT NULL, -- JSON
  chain TEXT NOT NULL -- JSON
);

DROP TABLE IF EXISTS knowledge;
CREATE TABLE knowledge (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  embeddings TEXT NOT NULL,
  chunk_size INTEGER NOT NULL,
  persist_directory TEXT NOT NULL
);
