Add Alembic migration framework for PostgreSQL#21
Merged
Conversation
Version-tracked database migrations using raw SQL (no SQLAlchemy ORM). - alembic/ directory with env.py reading AWARENESS_DATABASE_URL - Initial schema migration (baseline of current v0.3.1 schema) - pgvector extension migration (CREATE EXTENSION IF NOT EXISTS vector) - mcp-awareness-migrate CLI (upgrade/stamp/current/history/downgrade) - Removed inline migration code from PostgresStore - Dockerfile includes alembic.ini and migration files - RDS-compatible: works with standard Postgres connection strings SQLite retains inline migrations (Alembic is Postgres-only). 155 tests pass, all CI checks clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
docker-entrypoint.sh runs mcp-awareness-migrate before starting the server when AWARENESS_BACKEND=postgres. Idempotent — safe on existing databases (all DDL uses IF NOT EXISTS). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cmeans
added a commit
that referenced
this pull request
Mar 22, 2026
Missed in PR #21 — the PR conventions rule (CLAUDE.md) should have caught this. Adding Alembic migration framework to Implemented list. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cmeans
pushed a commit
that referenced
this pull request
Mar 31, 2026
OllamaEmbedding.embed() now checks len(embeddings) == len(texts) and raises ValueError on mismatch. This prevents silent data loss when zip(strict=False) in backfill_embeddings would quietly drop entries if Ollama returned a partial response (MEDIUM #21). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cmeans
pushed a commit
that referenced
this pull request
Mar 31, 2026
OllamaEmbedding.embed() now checks len(embeddings) == len(texts) and raises ValueError on mismatch. This prevents silent data loss when zip(strict=False) in backfill_embeddings would quietly drop entries if Ollama returned a partial response (MEDIUM #21). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cmeans
pushed a commit
that referenced
this pull request
Mar 31, 2026
OllamaEmbedding.embed() now checks len(embeddings) == len(texts) and raises ValueError on mismatch. This prevents silent data loss when zip(strict=False) in backfill_embeddings would quietly drop entries if Ollama returned a partial response (MEDIUM #21). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
cmeans-claude-dev Bot
added a commit
that referenced
this pull request
Mar 31, 2026
fix: validate Ollama embedding response count (MEDIUM #21)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Version-tracked database migrations using Alembic with raw SQL (no SQLAlchemy ORM). Replaces inline migration code in PostgresStore.
alembic/directory withenv.pyreadingAWARENESS_DATABASE_URLCREATE EXTENSION IF NOT EXISTS vectormcp-awareness-migrateCLI: upgrade, stamp, current, history, downgradeSQLite retains inline migrations — Alembic is Postgres-only.
Origin
Code review flagged "no schema versioning" as weakness #10. Inline
_create_tablesmigrations don't track versions, making it impossible to know what state a database is in or roll back changes.CHANGELOG
[Unreleased]README
QA: Manual testing steps
Prerequisites
git checkout alembic-migrationspip install -e ".[dev]"to pick up alembic + sqlalchemydocker compose up -d postgres)1. Check current migration status
a0f1c4855eb2 (head)or9184f91831f8 (head)2. For existing database — stamp as current
If running against a database that was created before Alembic:
alembic_versiontable exists with current revision3. For fresh database — run migrations
entriesexists with all columns includinglogical_key4. View history
5. Start server and verify it works
5b. Docker rebuild (production deployment)
docker compose build && docker compose up -d6. Cleanup
psql ... -c "DROP DATABASE IF EXISTS awareness_test"(if created in step 3)Automated tests
🤖 Generated with Claude Code