Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ jobs:
- name: Run tests for sqlite
run:
just test_sqlite
- name: Verify tortoise upgrading for sqlite migrations
if: matrix.tortoise-orm == 'tortoise025'
run: |
TEST_DB=sqlite://db.sqlite3 aerich init-db
TEST_DB=sqlite://db.sqlite3 aerich migrate
TEST_DB=sqlite://db.sqlite3 aerich upgrade
uv pip install --upgrade "tortoise-orm>=1.1"
TEST_DB=sqlite://db.sqlite3 aerich migrate
TEST_DB=sqlite://db.sqlite3 aerich upgrade
- name: Show test coverage
run: just report

Expand Down
12 changes: 11 additions & 1 deletion aerich/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from aerich.coder import load_index
from aerich.ddl import BaseDDL
from aerich.enums import Color
from aerich.exceptions import NotSupportError
from aerich.models import MAX_VERSION_LENGTH, Aerich
from aerich.utils import (
decompress_dict,
Expand Down Expand Up @@ -1022,11 +1023,20 @@ def _handle_field_changes(
elif option == "description":
# change comment
cls._add_operator(cls._set_comment(model, new_data_field), upgrade)
elif option == "python-type":
# When upgrade tortoise-orm from 0.x to 1.x
# JSONField[Union[dict, list]] -> JSONField[dict | list]
continue
else:
if modified or (action != "change" and old_new == [("db_default", "__NOT_SET__")]):
continue
# modify column
cls._add_operator(cls._modify_field(model, new_data_field), upgrade)
try:
sql = cls._modify_field(model, new_data_field)
except NotSupportError:
click.echo(f"{model = }; {field_name = }; {change = }")
raise
cls._add_operator(sql, upgrade)
modified = True

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion aerich/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.10.1.dev1"
__version__ = "0.10.1.dev2"
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading