alembic-migration
/alembic-migration
Tworzy, sprawdza i stosuje zmiany schematu bazy przez Alembic, gdy zmienia się model SQLAlchemy, kolumna, indeks, ograniczenie lub potrzebny jest backfill danych.
- Autor
- AnkonKumarSingh ↗
- Repozytorium
- InnovateIT-Agent-OS-AI-Agent-Platform ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 06.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 06.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Tworzy, sprawdza i stosuje zmiany schematu bazy przez Alembic, gdy zmienia się model SQLAlchemy, kolumna, indeks, ograniczenie lub potrzebny jest backfill danych.
Oryginalny opis (EN)
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
Jak działa
- Workflow
- Data migrations / backfills
- Rules
Podgląd SKILL.md
--- name: alembic-migration description: Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema. --- # Alembic Migrations This project uses **async SQLAlchemy 2.0 + Alembic** on PostgreSQL. Migrations live in `backend/alembic/versions/` and are numbered (`0001_…`, `0002_…`). ## Workflow 1. **Change the model first** in `backend/app/db/models/` (`Mapped[...]` + `mapped_column()`, `__repr__`, relationships with `ondelete="CASCADE"`). Make sure the model is imported in `backend/app/db/models/__init__.py` so autogenerate sees it. 2. **Autogenerate** the migration: ```bash cd backend && uv run alembic revision --autogenerate -m "add <thing>" # or: make db-migrate ``` 3. **ALWAYS review the generated file.** Autogenerate is a draft, not the truth: - Confirm `upgrade()` matches your intent and `downgrade()` actually reverses it. - Check the `down_revision` chains onto the current head (`uv run alembic heads`). - Watch for dropped columns/tables you didn't intend, server defaults, enum changes, and JSON/array types. - Name the revision file with the next sequential prefix to match the existing convention. 4. **Apply and verify:** ```bash cd backend && uv run alembic upgrade head # or: make db-upgrade uv run alembic current # confirm at head ``` Then round-trip once to prove `downgrade()` works: `alembic downgrade -1 && alembic upgrade head`. ## Data migrations / backfills For backfills, add explicit `op.execute(...)` or a small data-loop in `upgrade()` (see the existing `*_backfill_*.py` migrations for the pattern). Keep schema and data changes in separate, well-named revisions when practical. ## Rules - Never edit a migration that has already been applied in shared environments — add a new one. - `make dev` / `make bootstrap` run `alembic upgrade head` automatically; you don't need a separate step in dev. - Keep models and migrations in sync — a model change without a migration will pass tests (sessions are mocked) but break on real Postgres.
Wersje
W bazie nie ma innych skilli o nazwie alembic-migration.
Migawka bazy z 13.11.2026 · wersja paczki 1b816e32141f (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100alembic
Zarządza migracjami bazy danych dla SQLAlchemy przez Alembic: wersjonowanie schematu, autogenerowanie skryptów z modeli, uruchamianie i wycofywanie migracji oraz asynchroniczne migracje. - 100db-migration
Pomaga przygotować zmianę schematu lub danych PostgreSQL przez Liquibase albo Flyway: nowa tabela, kolumna, indeks, ograniczenie, backfill i migracja bez przestojów. - 90sqlalchemy-code-review
Przegląda kod SQLAlchemy pod kątem zarządzania sesją, relacji, zapytań N+1 i wzorców migracji z Alembic. - 85sqlalchemy-code-review
Przegląda kod SQLAlchemy pod kątem zarządzania sesją, relacji, zapytań N+1 i migracji Alembic, zwłaszcza w wersji 2.0. - 100python-database-ops
Stosuje wzorce SQLAlchemy i baz danych w Python: ORM, migracje Alembic, asynchroniczny dostęp do bazy, pula połączeń, repozytorium i unit of work. - 100database-migration-patterns
Bezpiecznie zarządza zmianami schematu bazy danych: narzędzia migracji (Alembic, SQL), strategie bez przestojów, migracje danych, wycofywanie i testowanie.