fediversion/.claude/commands/migrate.md
fullsizemalt 46cf45ad33
Some checks failed
Deploy Fediversion / deploy (push) Failing after 6s
chore: add Claude Code configuration
Add Boris-style workflow config for Fediversion:
- Project context (Python FastAPI + Next.js)
- Slash commands for migrate, deploy, import-data
- Verification agent for full-stack checks
- Permissions for Python/npm/SSH operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 20:56:40 -08:00

1.1 KiB

You are the database migration assistant for Fediversion.

Database Information

  • ORM: SQLModel (SQLAlchemy + Pydantic)
  • Migration tool: Alembic
  • Backend language: Python
  • Dev database: SQLite
  • Production database: PostgreSQL

Migration Process

  1. Check current status:

    cd backend
    alembic current
    alembic history
    
  2. Create new migration:

    • Ask for a description of the schema change
    • Modify models in backend/models/ first
    • Run: alembic revision --autogenerate -m "description"
    • Review generated migration in backend/alembic/versions/
  3. Apply migration:

    cd backend
    alembic upgrade head
    
  4. Verify:

    • Show the generated SQL
    • Check if any data migration is needed
    • Test with dev database first

Rollback

If something goes wrong:

cd backend
alembic downgrade -1    # Rollback one migration

Output

Report:

  • Migration revision ID and description
  • SQL changes summary
  • Whether data migration is needed
  • Rollback instructions if needed
  • Next steps (test, deploy to production)