specx-sqlalchemy-migrations
/specx-sqlalchemy-migrations
Dodaje lub naprawia migracje Alembic w usługach Python z SQLAlchemy, zastępując bootstrap schematu i testując dryf migracji.
- Autor
- maksimzayats ↗
- Repozytorium
- fastdjango ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 26.07.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 26.07.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
Dodaje lub naprawia migracje Alembic w usługach Python z SQLAlchemy, zastępując bootstrap schematu i testując dryf migracji.
Oryginalny opis (EN)
Add or repair Alembic migrations for specx SQLAlchemy services. Use when adding SQLAlchemy models or repositories, replacing metadata.create_all schema bootstraps, creating async Alembic env.py, adding migration Makefile targets, generating initial revisions, or testing migration drift.
Jak działa
- Workflow
- Guardrails
- Code Style
- References
Podgląd SKILL.md
---
name: specx-sqlalchemy-migrations
description: Add or repair Alembic migrations for specx SQLAlchemy services. Use when adding SQLAlchemy models or repositories, replacing metadata.create_all schema bootstraps, creating async Alembic env.py, adding migration Makefile targets, generating initial revisions, or testing migration drift.
---
# specx SQLAlchemy Migrations
Use this skill whenever a specx project has SQLAlchemy models or persistence
adapters. Read `references/alembic.md` before editing migration files.
## Workflow
1. Add `alembic>=1.18.5` as a runtime dependency when SQLAlchemy adapters
exist, together with SQLAlchemy's asyncio extra and the selected driver.
2. Add `alembic.ini`, `migrations/env.py`, `migrations/script.py.mako`, and
`migrations/versions/`.
3. Use Alembic's async pattern for async SQLAlchemy engines.
4. Put app-wide SQLAlchemy settings/session factory under top-level
`infrastructure/sqlalchemy/`.
5. Keep scope-owned ORM models and repositories under
`core/<scope>/infrastructure/sqlalchemy/`.
6. Add a project-local SQLAlchemy declarative base under
`src/<package>/foundation/sqlalchemy_model.py`; do not use shared packaged
metadata for generated services.
7. Put reusable model discovery under top-level
`infrastructure/sqlalchemy/model_discovery.py`. Use that same function from
`migrations/env.py` and its guardrail test before assigning
`target_metadata`; do not duplicate discovery or maintain hard-coded model
module names.
8. Set `target_metadata` to the project-local `BaseSQLAlchemyModel.metadata`.
9. Generate or hand-review an initial migration for current models.
10. Add `make migrate` and `make makemigrations`.
11. Add tests that run `alembic upgrade head` against an isolated database,
check for pending autogenerate changes, and prove every core SQLAlchemy
model file is included by the exact discovery function Alembic uses. Use
the production database family when dialect behavior matters.
## Guardrails
- Do not call `Base.metadata.create_all`, `metadata.create_all`, or
`drop_all` from `src/`.
- Do not run migrations from FastAPI startup by default. Run migrations as an
operational command before app startup.
- Do not put app-wide engine/session factory code inside one core scope.
- Do not let delivery controllers import ORM models, repositories, sessions, or
migration helpers.
- Do not let Alembic drift checks depend on incomplete metadata. Model discovery
must include every `core/*/infrastructure/sqlalchemy/models/*.py` file.
- Do not trust autogenerated migrations without review.
- Do not edit, delete, or reorder a revision that may already have been applied;
add a new corrective revision.
- Do not pass SQLite's `autocommit` connect argument on Python 3.11. For a
savepoint-based SQLite test harness spanning Python versions, use
SQLAlchemy's `connect` and `begin` event-hook recipe.
## Code Style
Use blank lines as logical separators in all code. Keep related statements
together, but separate independent setup, action, assertion, response, branch,
and transformation groups so long blocks stay readable.
## References
- `references/alembic.md` - async Alembic layout, env.py, Makefile targets,
initial migration, and migration tests.
Pliki w paczce (3)
- SKILL.md 3 KB
- agents/openai.yaml 1 KB
- references/alembic.md 15 KB
Wersje
W bazie nie ma innych skilli o nazwie specx-sqlalchemy-migrations.
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 83443d17f0c7 (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. - 100sqlalchemy
Pomaga w asynchronicznym SQLAlchemy 2.0: modele, zapytania, sesje i migracje Alembic bez zapytań N+1. - 100alembic-migrations
Konfiguruje migracje Alembic dla asynchronicznego SQLAlchemy: async engine z run_sync w env.py, autogenerate i migracje RLS dla wielu najemców. - 100sqlalchemy
Pomaga pisać asynchroniczny kod SQLAlchemy 2.0, czyli sesje, relacje ładowane bez N+1 i migracje Alembic. - 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.