feat: migrate to Postgres + pgvector with Alembic scaffolding
Switch the default database from SQLite to Postgres + pgvector (via pgvector/pgvector:pg16 Docker image) to support the upcoming vision pipeline (embeddings, OCR, object detection, face clustering). - Add `db` service to docker-compose.yml with healthcheck - Wire `alembic upgrade head` into backend CMD before uvicorn - Bootstrap empty 0001_baseline revision (schema still owned by create_all) - Guard SQLite-only PRAGMAs and inline ALTERs behind _is_sqlite flag - Run `CREATE EXTENSION IF NOT EXISTS vector` on Postgres init - Add asyncpg, psycopg2-binary, pgvector to requirements - Provide docker-compose.sqlite.yml escape hatch for legacy SQLite mode Fresh DB + rescan assumed — no SQLite→Postgres data migration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,9 +39,11 @@ class MulitaConfig(BaseModel):
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application settings"""
|
||||
# Database
|
||||
# Database — Postgres + pgvector by default. The SQLite escape hatch
|
||||
# remains supported via the docker-compose.sqlite.yml override and by
|
||||
# setting DATABASE_URL=sqlite+aiosqlite:///... in .env for local dev.
|
||||
database_url: str = Field(
|
||||
default="sqlite+aiosqlite:///data/db/mulita.db",
|
||||
default="postgresql+asyncpg://mulita:mulita@db:5432/mulita",
|
||||
env="DATABASE_URL"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user