Skip to content

docs: add complete alembic integration example#1741

Draft
pctablet505 wants to merge 2 commits into
ormar-orm:masterfrom
pctablet505:fix-1400-alembic-docs-example
Draft

docs: add complete alembic integration example#1741
pctablet505 wants to merge 2 commits into
ormar-orm:masterfrom
pctablet505:fix-1400-alembic-docs-example

Conversation

@pctablet505

@pctablet505 pctablet505 commented Jul 15, 2026

Copy link
Copy Markdown

Fixes #1400.

The current Alembic docs skip too many steps for anyone new to ormar — imports, where metadata comes from, and how to handle models split across apps. I added a complete, working example based on the FastAPI-template reference linked in the issue.

It covers a single-file layout, a multi-app layout, a minimal alembic.ini, and wiring the shared metadata into alembic/env.py. I ran alembic revision --autogenerate and alembic upgrade head against both layouts and built the docs with mkdocs build to make sure everything works.

Expand the migrations/Alembic docs with a working, end-to-end example:

- Explain where the SQLAlchemy MetaData comes from in ormar and how to
  expose it for Alembic.
- Add a sample project layout with my_project/models.py, alembic.ini,
  and alembic/env.py.
- Show how to handle models split across multiple apps/packages by
  importing all models before Alembic reads the metadata.
- Keep the existing compare_type and include_object tips intact.

Fixes ormar-orm#1400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A *working* alembic example in the docs

1 participant