add alembic for migrations#11
Open
swelborn wants to merge 3 commits into
Open
Conversation
This was referenced Jul 12, 2026
There was a problem hiding this comment.
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.tomlconfiguration and hooks for formatting/checking generated revisions. - Introduce an initial migration for the existing
cachestable and add an autogeneration helper script. - Remove startup-time
create_all()initialization and runalembic upgrade headvia systemdExecStartPre.
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.
added 3 commits
July 12, 2026 17:51
swelborn
force-pushed
the
key-not-transfer-id
branch
from
July 12, 2026 21:51
e18cbdf to
979ca00
Compare
This was referenced Jul 12, 2026
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.
This is part 7 of 10 in a stack made with GitButler: