aerich
A database migrations tool for Tortoise ORM.
What it is and what it does
Aerich is a migration tool designed specifically for TortoiseORM, an async Python ORM. It provides a command-line interface and programmatic API to generate, version, and apply database schema changes. The tool detects model changes, generates migration files with timestamped versions, and can upgrade or downgrade the database schema. It also includes an inspectdb command to reverse-engineer existing database tables into TortoiseORM model definitions.
The package depends on tortoise-orm (the ORM it targets), dictdiffer (for comparing model states), asyncclick (for CLI), and anyio (for async compatibility). It's actively maintained and supports modern Python versions (3.10 through 3.14). However, the project's own documentation warns that tortoise-orm>=1.0.0 includes built-in migration support as an alternative, so users should verify whether Aerich or the built-in solution better fits their needs.
Use it for:
- Track and apply schema changes in TortoiseORM projects without manually writing SQL or managing version state.
- Reverse-engineer existing MySQL, PostgreSQL, or SQLite databases into TortoiseORM model definitions via inspectdb.
- Manage multiple database connections and per-app migration directories in complex projects.
- Programmatically run migrations within an application using the Command class instead of CLI.
- Roll back database changes to a previous version when a migration causes issues.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Aerich is a database migration tool for TortoiseORM that generates, tracks, and applies schema changes through a CLI and programmatic interface, similar to Alembic for SQLAlchemy.
Yes, if you are using TortoiseORM and need structured database migrations. The package is actively maintained, has no known vulnerabilities, and low install friction. However, check whether tortoise-orm>=1.0.0's built-in migration support meets your needs first, as the project itself recommends it as an alternative for newer versions.
Install
aerich on PyPI
pip
pip install aerichuv
uv add aerichpoetry
poetry add aerichInstalling aerich
Before you install
Installation is straightforward with low friction—a pure-Python wheel with four runtime dependencies. The package is actively maintained with a recent release and no known vulnerabilities, though the warning in its own documentation notes that tortoise-orm>=1.0.0 includes built-in migration support as an alternative.
License in practice
Licensed under Apache-2.0 (permissive), which allows free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install aerich
# In your project, add aerich.models to your Tortoise-ORM config:
TORTOISE_ORM = {
"connections": {"default": "sqlite://:memory:"},
"apps": {
"models": {
"models": ["myapp.models", "aerich.models"],
"default_connection": "default",
},
},
}
# Then initialize and run migrations:
# aerich init -t myapp.config.TORTOISE_ORM
# aerich init-db
# aerich migrate --name add_column
# aerich upgrade
Requires Python >=3.10; tortoise-orm must be installed and configured with aerich.models included in the app config.
Verify before relying
- Whether the built-in migration support in tortoise-orm>=1.0.0 fully replaces Aerich's functionality or if Aerich offers additional features.
- Support for databases beyond MySQL, PostgreSQL, and SQLite mentioned in the inspectdb command.
- Performance characteristics when handling large numbers of migration files.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — tortoise-orm, dictdiffer, asyncclick, anyio |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 274,337/month — #8,192 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aerich-0.10.0-py3-none-any.whl
Keywords: migrate, Tortoise-ORM, mysql, postgresql
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
tortoise-ormTortoise ORM is an async-native…
permissive · top 15,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
pypika-tortoiseGenerates SQL queries programmatically for…
permissive · top 15,000 on PyPI
peewee-migratePeewee Migrate provides a command-line and…
permissive · top 15,000 on PyPI
Flask-MigrateFlask-Migrate handles SQLAlchemy database…
permissive · top 5,000 on PyPI
pytest-alembicA pytest plugin that runs built-in and custom…
permissive · top 5,000 on PyPI
mongodb-migrationsManages schema migrations for MongoDB databases…
copyleft · top 15,000 on PyPI
sqlalchemy-migrateProvides database schema migration management…
permissive · top 15,000 on PyPI
yoyo-migrationsYoyo-migrations is a database schema migration…
permissive · top 15,000 on PyPI
Flask-AlembicFlask-Alembic integrates Alembic database…
permissive · top 15,000 on PyPI