{"id":7899,"library":"aerich","title":"Aerich","description":"Aerich is a database migrations tool specifically designed for Tortoise ORM. It automates schema evolution by generating and applying migration scripts, making it easier to manage database changes in Python projects. It is actively maintained, with version 0.9.2 being the latest as of early 2024, and features regular releases for bug fixes and new functionality.","status":"active","version":"0.9.2","language":"python","source_language":"en","source_url":"https://github.com/aerich/aerich","tags":["database","migrations","ORM","Tortoise-ORM","cli"],"install":[{"cmd":"pip install aerich","lang":"bash","label":"Install Aerich"}],"dependencies":[{"reason":"Aerich is a migration tool exclusively for Tortoise ORM.","package":"tortoise-orm","optional":false}],"imports":[{"wrong":"from aerich.commands import AerichCommand","symbol":"Aerich","correct":"from aerich import Aerich"},{"symbol":"Command","correct":"from aerich import Command"},{"symbol":"Migrate","correct":"from aerich import Migrate"}],"quickstart":{"code":"# config.py\nfrom tortoise import fields, models\n\nclass User(models.Model):\n    id = fields.IntField(pk=True)\n    name = fields.CharField(max_length=255)\n\n    class Meta:\n        table = \"users\"\n\n\nTORTOISE_CONFIG = {\n    \"connections\": {\"default\": \"sqlite://db.sqlite3\"},\n    \"apps\": {\n        \"models\": {\n            \"models\": [\"config\", \"aerich.models\"], # \"config\" refers to models defined in this file\n            \"default_connection\": \"default\",\n        }\n    },\n}","lang":"python","description":"This quickstart provides the content for a `config.py` file, defining a simple Tortoise-ORM configuration (`TORTOISE_CONFIG`) and a `User` model. To use Aerich:\n\n1. Save the above content as `config.py` in your project root.\n2. Run the following commands in your terminal to initialize Aerich, create, and apply migrations:\n   ```bash\n   aerich init -t config.TORTOISE_CONFIG\n   aerich migrate\n   aerich upgrade\n   ```"},"warnings":[{"fix":"Always use the `-t` or `--tortoise-config` command-line argument to specify your Tortoise-ORM configuration module and variable name, e.g., `aerich init -t my_app.config.TORTOISE_CONFIG`.","message":"Aerich versions 0.6.0 and later removed the `AERICH_CONFIG` environment variable and changed how Tortoise-ORM configuration is specified.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Ensure your `TORTOISE_CONFIG['apps']['models']['models']` list includes `'aerich.models'`, for example: `\"models\": [\"your_app.models\", \"aerich.models\"]`.","message":"Failing to include `aerich.models` in your `TORTOISE_CONFIG['apps']['models']['models']` list will prevent Aerich from managing its internal schema and lead to errors.","severity":"gotcha","affected_versions":"All"},{"fix":"For persistent migrations, always configure a file-based SQLite database (e.g., `sqlite://db.sqlite3`) or a connection to a persistent database server.","message":"Using `sqlite://:memory:` in your `TORTOISE_CONFIG` for database connections will result in database changes (including migrations) not being persisted.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'0.9.2':39 '2024':46 'activ':35 'aerich':1,2 'appli':20 'autom':14 'bug':52 'chang':29 'cli':63 'databas':5,28,57 'design':9 'earli':45 'easier':25 'evolut':16 'featur':48 'fix':53 'function':56 'generat':18 'latest':42 'maintain':36 'make':23 'manag':27 'migrat':6,21,58 'new':55 'orm':12,59,62 'project':32 'python':31 'regular':49 'releas':50 'schema':15 'script':22 'specif':8 'tool':7 'tortois':11,61 'tortoise-orm':60 'version':38","created_at":"2026-04-16T16:58:28.480438+00:00","updated_at":"2026-04-16T16:58:28.480438+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.9.2","cli_name":"aerich","cli_version":"aerich, version 0.9.2","type":"library","homepage":null,"github":"https://github.com/tortoise/aerich","docs":"https://github.com/tortoise/aerich","changelog":null,"pypi":"https://pypi.org/project/aerich/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}