Skip to content

Database

Brevia data are stored in a Postgres database, any version from v12 onwards is supported. PostgreSQL provides ACID compliance, point-in-time recovery, JOINs, and many other great features.

Schema

Brevia database schema consists, as of now, of just five tables:

  • alembic_version - used by Alembic to keep track of migration status
  • async_jobs - store asynchronous jobs data
  • config - store configuration data
  • langchain_pg_collection - collection information, table used by Postgres vector store in LangChainChain
  • langchain_pg_embedding - collection embeddings, used by Postgres vector store in LangChain
  • chat_history - store chat messages history

Here a simple ERD diagram of Brevia database schema

ERD Brevia

Migrations

Schema migrations are handled by Alembic. You can create or update the database schema to the latest version using this command, after activating the virtual env (with poetry shell for instance)

db_upgrade

This command should be launched after every upgrade of Brevia make sure the db structure is up to date.