Copilot commented on code in PR #64311:
URL: https://github.com/apache/airflow/pull/64311#discussion_r3066489675


##########
airflow-core/tests/unit/utils/test_db.py:
##########
@@ -180,6 +180,9 @@ def 
test_database_schema_and_sqlalchemy_model_are_in_sync(self, initialized_db):
             lambda t: t[0] == "add_index" and t[1].name == 
"idx_ab_user_username",
             lambda t: t[0] == "remove_index" and t[1].name == 
"idx_ab_register_user_username",
             lambda t: t[0] == "remove_index" and t[1].name == 
"idx_ab_user_username",
+            # MySQL auto-creates an index on FK columns; the migration skips 
creating this
+            # index on MySQL to avoid a duplicate, but the ORM always declares 
it.
+            lambda t: t[0] == "add_index" and t[1].name == 
"idx_task_instance_dag_version_id",
         ]

Review Comment:
   The new ignore for `idx_task_instance_dag_version_id` is applied 
unconditionally, which means this schema-sync test would also ignore a 
missing/renamed `dag_version_id` index on non-MySQL backends. Consider only 
adding this ignore when the active dialect is MySQL (where the migration 
intentionally skips creating the named index).
   ```suggestion
           ]
   
           if settings.engine.dialect.name == "mysql":
               # MySQL auto-creates an index on FK columns; the migration skips 
creating this
               # index on MySQL to avoid a duplicate, but the ORM always 
declares it.
               ignores.append(lambda t: t[0] == "add_index" and t[1].name == 
"idx_task_instance_dag_version_id")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to