Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@waketzheng
Copy link
Contributor

@waketzheng waketzheng commented Oct 18, 2025

Description

Close #171

Usage

aerich init -t settings.TORTOISE_ORM --location "./{app}/migrations"

Example

  • settings.py
TORTOISE_ORM = {
    'connections': {'default': 'sqlite://db.sqlite3'},
    'apps': {
        'auth': {'models': ['auth.models', 'aerich.models']},
        'polls': {'models': ['polls.models']}
    }
}
  • files
.
├── auth
│   ├── __init__.py
│   └── models.py
├── polls
│   ├── __init__.py
│   └── models.py
└── settings.py
  • Commands:
aerich init -t settings.TORTOISE_ORM --location "./{app}/migrations"
tree .
  • Result:
.
├── auth
│   ├── __init__.py
│   ├── migrations
│   └── models.py
├── polls
│   ├── __init__.py
│   ├── migrations
│   └── models.py
├── pyproject.toml
└── settings.py
  • Commands:
aerich --app auth init-db
aerich --app polls init-db
tree .
  • Result:
.
├── auth
│   ├── __init__.py
│   ├── migrations
│   │   └── 0_20251022001552_init.py
│   └── models.py
├── db.sqlite3
├── polls
│   ├── __init__.py
│   ├── migrations
│   │   └── 0_20251022001625_init.py
│   └── models.py
├── pyproject.toml
└── settings.py

@waketzheng waketzheng merged commit 08c9107 into tortoise:dev Oct 21, 2025
34 checks passed
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.

Aerich puts all migrations in one folder, I expect per-app folders structure

1 participant