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


##########
airflow-core/src/airflow/migrations/versions/0117_3_3_0_change_deadline_interval_to_json.py:
##########
@@ -173,18 +188,20 @@ def downgrade():
 
             MySQL:
 
-            Step 1: Convert values
+            Step 1: Convert values. Leave them as JSON numbers; the column is 
still JSON
+            here, so casting to DOUBLE fails with ER_INVALID_JSON_TEXT (3140). 
The cast
+            happens in Step 2 instead.
             UPDATE deadline_alert
             SET `interval` =
                 CASE
                     WHEN JSON_EXTRACT(`interval`, '$.__data__') IS NOT NULL
-                        THEN CAST(JSON_EXTRACT(`interval`, '$.__data__') AS 
DOUBLE)
+                        THEN JSON_EXTRACT(`interval`, '$.__data__')
                     WHEN JSON_EXTRACT(`interval`, '$.__classname__') IS NULL
-                        THEN CAST(`interval` AS DOUBLE)
+                        THEN `interval`
                     ELSE NULL
                 END;
 
-            Step 2: Convert column type
+            Step 2: Convert column type. This casts the JSON numbers to DOUBLE.
             ALTER TABLE deadline_alert
             MODIFY COLUMN `interval` DOUBLE;

Review Comment:
   The MySQL offline-mode downgrade instructions still say the column should be 
retyped to `DOUBLE`, but the online migration downgrades back to `sa.FLOAT()` 
(and the regression test uses `FLOAT`). This mismatch can mislead operators 
running manual/offline downgrades and result in a schema that differs from what 
Alembic would produce.



-- 
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