Skip to content

Database

Sasha Baranov edited this page Jun 12, 2026 · 1 revision

Database

Aicraft stores chat history, web sessions, and link requests in a database. The database is always initialized — even when the web UI is disabled.

SQLite (default)

Zero setup. On first startup:

  1. Creates plugins/Aicraft/aicraft.db
  2. Runs migrations automatically
  3. Creates all required tables
database:
  type: sqlite
  sqlite-file: "aicraft.db"

You never need to run SQL manually.

Postgres

Create the database on your Postgres server first, then configure:

database:
  type: postgres
  postgres:
    host: "localhost"
    port: 5432
    database: "aicraft"
    username: "aicraft"
    password: "your-password"

Migrations run automatically on startup.

Schema overview

Table Purpose
chats Chat sessions per player (with per-player chat number)
chat_messages Messages (user, assistant, system)
web_sessions Linked web UI sessions
link_requests Pending /ailink verification codes
schema_version Migration tracking

Backups

For SQLite, stop the server (or ensure no writes) and copy plugins/Aicraft/aicraft.db. For Postgres, use your normal backup tooling.

Clone this wiki locally