Skip to content

Commit

Permalink
chore: fix pycharm complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
waketzheng committed Dec 23, 2024
1 parent 1c8faee commit 5d460be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aerich/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import asyncclick as click
from dictdiffer import diff
from tortoise import BaseDBAsyncClient, Model, Tortoise
from tortoise import BaseDBAsyncClient, ConfigurationError, Model, Tortoise
from tortoise.exceptions import OperationalError
from tortoise.indexes import Index

Expand Down Expand Up @@ -248,6 +248,8 @@ def _handle_m2m_fields(
if new_m2m_field["name"] == new_value:
table = cast(str, new_m2m_field.get("through"))
break
else:
raise ConfigurationError(f"{new_value!r} not found in new_m2m_fields!")
else:
table = new_value.get("through")
if action == "add":
Expand Down Expand Up @@ -405,7 +407,7 @@ def diff_models(
if new_model_str not in models_with_rename_field:
if models_with_rename_field:
# When there are multi rename fields with different models,
# print a empty line to warn that is another model
# print an empty line to warn that is another model
prefix = "\n" + prefix
models_with_rename_field.add(new_model_str)
is_rename = click.prompt(
Expand Down Expand Up @@ -603,7 +605,7 @@ def _resolve_fk_fields_name(cls, model: Type[Model], fields_name: Iterable[str])
try:
field = model._meta.fields_map[field_name]
except KeyError:
# field dropped or to be add
# field dropped or to be added
pass
else:
if field.source_field:
Expand Down Expand Up @@ -695,7 +697,7 @@ def _add_fk(
@classmethod
def _merge_operators(cls) -> None:
"""
fk/m2m/index must be last when add,first when drop
fk/m2m/index must be last when add, first when drop
:return:
"""
for _upgrade_fk_m2m_operator in cls._upgrade_fk_m2m_index_operators:
Expand Down

0 comments on commit 5d460be

Please sign in to comment.