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 statusasync_jobs
- store asynchronous jobs dataconfig
- store configuration datalangchain_pg_collection
- collection information, table used by Postgres vector store in LangChainChainlangchain_pg_embedding
- collection embeddings, used by Postgres vector store in LangChainchat_history
- store chat messages history
Here a simple ERD diagram of Brevia database schema
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.