Skip to content

src/db/schema.sql is not included in the built package — pipx installs cannot bootstrap the base schema #54

Description

@bgimbel

src/db/schema.sql is not included in the built package — pipx installs cannot bootstrap the base schema

Summary

The pip/pipx-installed package ships the incremental migrations (src/db/migrations/*.sql) but not the base schema file src/db/schema.sql. Any install path that doesn't go through the Docker stack has no way to create the core tables (memory, etc.) from the installed package alone.

Environment

  • open-brain installed via pipx install 'git+https://github.com/benclawbot/open-brain.git' (v1.0.0/1.0.1, master as of 2026-07-31)
  • Python 3.12, Ubuntu (WSL2), external PostgreSQL 17 + pgvector (no Docker)

Reproduction

$ pipx install 'git+https://github.com/benclawbot/open-brain.git'
$ ls ~/.local/share/pipx/venvs/openbrain/lib/python3.12/site-packages/src/db/
migrations/  ...          # <-- no schema.sql
$ ls .../src/db/migrations/
002_continuity_foundation.sql ... 015_embedding_dim_change.sql   # 002-015 only, no 001/base

With no base schema applied, openbrain store fails:

Error: relation "memory" does not exist

(or, if a partial/hand-made memory table exists, migrations 014/015 ALTER it and mask the problem until an INSERT fails with column "source" of relation "memory" does not exist.)

Root cause

pyproject.toml package-data only globs the migrations directory:

[tool.setuptools.package-data]
config = ["*.yaml", "*.yml"]
"src.db" = ["migrations/*.sql"]

src/db/schema.sql matches neither pattern, so it's excluded from the wheel. The migration chain also starts at 002_ — there is no 001_ migration that creates the base tables, so the migrations alone can never bootstrap an empty database; they assume schema.sql was applied first (which only the Docker startup path does).

Suggested fix

Either (a) include the schema in package-data and have openbrain configure apply it before migrations:

"src.db" = ["schema.sql", "migrations/*.sql"]

or (b) convert schema.sql into a proper 001_base_schema.sql migration so the existing migration runner bootstraps empty databases with no special case.

Workaround

Download src/db/schema.sql from the repo and apply it manually with psql -f before using the CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions