Skip to content

SQLite migration fails: cannot add a STORED generated column via ALTER TABLE #561

Description

@jw-cpnet

Bug Description

The Alembic migration d7e8f9a0b1c2_add_structured_metadata_indexes.py (introduced in v0.18.1) fails on SQLite because it attempts to add a STORED generated column via ALTER TABLE, which SQLite does not support.

SQLite only allows adding VIRTUAL generated columns with ALTER TABLE ADD COLUMN, not STORED ones. See: https://www.sqlite.org/lang_altertable.html

Error

OperationalError: (sqlite3.OperationalError) cannot add a STORED column
[SQL: ALTER TABLE entity ADD COLUMN tags_json TEXT GENERATED ALWAYS AS
(json_extract(entity_metadata, '$.tags')) STORED]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Steps to Reproduce

  1. Have an existing basic-memory database created with v0.18.0 or earlier
  2. Upgrade to v0.18.1 (uvx basic-memory mcp --project <project>)
  3. Server fails to start during database migration

Workaround

Pin to v0.18.0 in .mcp.json:

{
    "mcpServers": {
        "basic-memory": {
            "command": "uvx",
            "args": ["basic-memory==0.18.0", "mcp", "--project", "my-project"]
        }
    }
}

Environment

  • basic-memory version: 0.18.1
  • Python: 3.12.11
  • OS: Arch Linux (kernel 6.17.7)
  • SQLite: system default

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