@@ -938,7 +938,7 @@ def describe_index(idx: Index) -> Index | dict:
938
938
}
939
939
940
940
941
- def test_migrate (mocker : MockerFixture ):
941
+ def test_migrate (mocker : MockerFixture , capsys ):
942
942
"""
943
943
models.py diff with old_models.py
944
944
- change email pk: id -> email_id
@@ -980,6 +980,7 @@ def test_migrate(mocker: MockerFixture):
980
980
Migrate .diff_models (old_models_describe , models_describe )
981
981
Migrate .diff_models (models_describe , old_models_describe , False )
982
982
Migrate ._merge_operators ()
983
+ warning_msg = "Aerich does not handle 'unique' attribution for m2m field. You may need to change the constraints in db manually."
983
984
if isinstance (Migrate .ddl , MysqlDDL ):
984
985
expected_upgrade_operators = {
985
986
"ALTER TABLE `category` MODIFY COLUMN `name` VARCHAR(200)" ,
@@ -1080,6 +1081,7 @@ def test_migrate(mocker: MockerFixture):
1080
1081
assert not downgrade_more_than_expected
1081
1082
downgrade_less_than_expected = expected_downgrade_operators - downgrade_operators
1082
1083
assert not downgrade_less_than_expected
1084
+ assert warning_msg in capsys .readouterr ().out
1083
1085
1084
1086
elif isinstance (Migrate .ddl , PostgresDDL ):
1085
1087
expected_upgrade_operators = {
@@ -1183,6 +1185,7 @@ def test_migrate(mocker: MockerFixture):
1183
1185
assert not downgrade_more_than_expected
1184
1186
downgrade_less_than_expected = expected_downgrade_operators - downgrade_operators
1185
1187
assert not downgrade_less_than_expected
1188
+ assert warning_msg in capsys .readouterr ().out
1186
1189
1187
1190
elif isinstance (Migrate .ddl , SqliteDDL ):
1188
1191
assert Migrate .upgrade_operators == []
0 commit comments