Skip to content

v0.5.3-beta: Database lifecycle & Alembic migration baseline - #32

Merged
DeepZone merged 1 commit into
mainfrom
codex/implement-database-lifecycle-and-migrations
May 20, 2026
Merged

v0.5.3-beta: Database lifecycle & Alembic migration baseline#32
DeepZone merged 1 commit into
mainfrom
codex/implement-database-lifecycle-and-migrations

Conversation

@DeepZone

Copy link
Copy Markdown
Owner

Motivation

  • Provide a traceable, production-safe database lifecycle for RouteForge by introducing Alembic migration support and a documented upgrade process.
  • Surface schema/migration state in the system status so operators can verify database migration health without exposing secrets.
  • Keep local/demo SQLite behavior convenient while ensuring production/Postgres uses migrations rather than implicit schema creation.
  • Ship migration-safe operational documentation and a clear baseline path for existing installations that used create_all.

Description

  • Added an Alembic environment under backend/alembic including env.py, script.py.mako and the initial baseline migration 0001_initial_schema that creates api_cache, checks and reports.
  • Extended backend system status logic (backend/app/core/system_status.py) to include schema_version, migration_status and migration_head, determined defensively via Alembic/SQLAlchemy with safe fallbacks.
  • Changed startup behavior in backend/app/main.py to only call Base.metadata.create_all() for SQLite (dev/demo) and rely on Alembic for production/Postgres migrations.
  • Updated frontend types and System UI (frontend/src/types.ts, frontend/src/App.tsx, frontend/src/components/Layout.tsx) to display schema version, migration head and a migration-status badge, and bumped visible versions to v0.5.3-beta.
  • Added/updated docs (docs/operations/upgrades.md, docs/operations/backup-restore.md, docs/operations/database-migrations.md, README.md, RELEASE_NOTES.md) describing migration commands, baseline instructions (alembic stamp 0001_initial_schema) and a safe production workflow.
  • Ensured container image can run Alembic by copying Alembic files into the backend image (backend/Dockerfile).

Testing

  • Ran backend smoke tests with pytest backend/tests/test_api_smoke.py -q and all tests passed (15 passed).
  • Built the frontend with npm run build and the production build completed successfully.
  • Attempted docker compose -f docker-compose.prod.yml config but the Docker CLI is not available in this environment so that check was not executed here.

Codex Task

@DeepZone
DeepZone merged commit a90803b into main May 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant