fix: KeyError raised when removing or renaming an existing model
This commit is contained in:
		| @@ -5,7 +5,7 @@ | |||||||
| ### [0.8.1](Unreleased) | ### [0.8.1](Unreleased) | ||||||
|  |  | ||||||
| #### Fixed | #### 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) | - 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 NonExistentKey when running `aerich init` without `[tool]` section in config file. (#284) | ||||||
| - Fix configuration file reading error when containing Chinese characters. (#286) | - Fix configuration file reading error when containing Chinese characters. (#286) | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ class Migrate: | |||||||
|  |  | ||||||
|     @classmethod |     @classmethod | ||||||
|     def _get_model(cls, model: str) -> Type[Model]: |     def _get_model(cls, model: str) -> Type[Model]: | ||||||
|         return Tortoise.apps[cls.app][model] |         return Tortoise.apps[cls.app].get(model)  # type: ignore | ||||||
|  |  | ||||||
|     @classmethod |     @classmethod | ||||||
|     async def get_last_version(cls) -> Optional[Aerich]: |     async def get_last_version(cls) -> Optional[Aerich]: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user