[P2] Migrate from custom migrations.py to Alembic #98

Closed
opened 2026-07-07 16:21:58 +12:00 by fastie81 · 0 comments
Owner

Problem

app/infrastructure/database/migrations.py is a custom migration system instead of using Alembic (standard for SQLAlchemy).

Expected Behavior

  • Use Alembic for version-controlled schema migrations
  • Auto-generate migration scripts from model changes
  • Track migration history in DB

Steps

  1. Add alembic to requirements.txt
  2. Run alembic init app/infrastructure/database/migrations
  3. Configure env.py to use app.core.entities.models
  4. Create initial migration: alembic revision --autogenerate -m "initial"
  5. Update entrypoint.sh to run alembic upgrade head
  • app/infrastructure/database/migrations.py (replace)
  • app/infrastructure/database/core.py (ClubDatabase.init_database)
  • entrypoint.sh (line 37-43)
### Problem `app/infrastructure/database/migrations.py` is a custom migration system instead of using Alembic (standard for SQLAlchemy). ### Expected Behavior - Use Alembic for version-controlled schema migrations - Auto-generate migration scripts from model changes - Track migration history in DB ### Steps 1. Add `alembic` to `requirements.txt` 2. Run `alembic init app/infrastructure/database/migrations` 3. Configure `env.py` to use `app.core.entities.models` 4. Create initial migration: `alembic revision --autogenerate -m "initial"` 5. Update entrypoint.sh to run `alembic upgrade head` ### Related Files - `app/infrastructure/database/migrations.py` (replace) - `app/infrastructure/database/core.py` (ClubDatabase.init_database) - `entrypoint.sh` (line 37-43)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fastie81/honbu-manager#98
No description provided.