Skip to content

Commit

Permalink
Update sort key to make it more frieldly interactive from multi field…
Browse files Browse the repository at this point in the history
…s rename
  • Loading branch information
waketzheng committed Dec 21, 2024
1 parent 1900ad1 commit 1c8faee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aerich/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,13 @@ def diff_models(
field_type = new_data_field.get("field_type")
db_column = new_data_field.get("db_column")
for old_data_field in sorted(
old_data_fields, key=lambda f: f.get("field_type") != field_type
old_data_fields,
key=lambda f: (
f.get("field_type") != field_type,
# old field whose name have more same characters with new field's
# should be put in front of the other
set(new_data_field_name).symmetric_difference(set(f.get("name", ""))),
),
):
changes = list(diff(old_data_field, new_data_field))
old_data_field_name = cast(str, old_data_field.get("name"))
Expand Down

0 comments on commit 1c8faee

Please sign in to comment.