Skip to content

add alembic for migrations#11

Open
swelborn wants to merge 3 commits into
key-not-transfer-idfrom
alembic
Open

add alembic for migrations#11
swelborn wants to merge 3 commits into
key-not-transfer-idfrom
alembic

Conversation

@swelborn

@swelborn swelborn commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Alembic-based schema migrations for the FastAPI service, replacing the prior “create tables on startup” approach and wiring migrations into local/dev workflows and the systemd unit.

Changes:

  • Add Alembic (and dependencies) plus pyproject.toml configuration and hooks for formatting/checking generated revisions.
  • Introduce an initial migration for the existing caches table and add an autogeneration helper script.
  • Remove startup-time create_all() initialization and run alembic upgrade head via systemd ExecStartPre.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Locks Alembic and template dependencies (mako/markupsafe).
systemd/fastcache-api.service Runs alembic upgrade head before starting the service.
src/fastcache_api/main.py Removes DB initialization from app lifespan startup.
src/fastcache_api/db.py Removes init_db() that previously ran Base.metadata.create_all().
src/fastcache_api/alembic/env.py Adds Alembic environment script for running migrations.
src/fastcache_api/alembic/script.py.mako Adds revision template for generated migrations.
src/fastcache_api/alembic/init.py Marks Alembic directory as a package for script_location.
src/fastcache_api/alembic/versions/init.py Marks versions directory as a package.
src/fastcache_api/alembic/versions/1d91b0606408_init.py Adds initial schema migration creating caches table.
scripts/gen_migration.py Adds helper to autogenerate migrations against a throwaway sqlite DB.
README.md Documents migration workflow and systemd pre-start migration behavior.
pyproject.toml Adds Alembic dependency and [tool.alembic] configuration + post-write hooks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fastcache_api/alembic/env.py
Comment thread scripts/gen_migration.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants