From 56da0e7e3c6329f122dfc46e37a15774e5b7f6f8 Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Thu, 12 Dec 2024 10:43:40 +0800 Subject: [PATCH] fix: KeyError raised when removing or renaming an existing model --- CHANGELOG.md | 2 +- aerich/migrate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 094dc16..dc1e287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### [0.8.1](Unreleased) #### Fixed -- fix: error when there is __init__.py in the migration folder (#272) +- fix: error when there is `__init__.py` in the migration folder (#272) - Setting null=false on m2m field causes migration to fail. (#334) - Fix NonExistentKey when running `aerich init` without `[tool]` section in config file. (#284) - Fix configuration file reading error when containing Chinese characters. (#286) diff --git a/aerich/migrate.py b/aerich/migrate.py index 3158b93..fd0f765 100644 --- a/aerich/migrate.py +++ b/aerich/migrate.py @@ -69,7 +69,7 @@ class Migrate: @classmethod def _get_model(cls, model: str) -> Type[Model]: - return Tortoise.apps[cls.app][model] + return Tortoise.apps[cls.app].get(model) # type: ignore @classmethod async def get_last_version(cls) -> Optional[Aerich]: