vatsrahul1001 opened a new pull request, #68337:
URL: https://github.com/apache/airflow/pull/68337

   The 3.3.0 migration `0117` (`8812eb67b63c`) converts 
`deadline_alert.interval` from `FLOAT` to `JSON` on upgrade and back on 
downgrade. On MySQL the downgrade unwrapped the value with `CAST(... AS 
DOUBLE)` inside an `UPDATE` that runs while the column is still typed `JSON`. 
Writing a non-JSON `DOUBLE` into a `JSON` column makes MySQL reject the whole 
statement:
   
   ```
   (MySQLdb.OperationalError) (3140, 'Invalid JSON text: "not a JSON text, may 
need CAST" at position 0 in value for column 'deadline_alert.interval'.')
   ```
   
   So `airflow db downgrade` fails on MySQL for any deployment with at least 
one `deadline_alert` row. (Caught by the Astronomer Runtime nightly KinD 
downgrade test against MySQL with seeded data.)
   
   The fix keeps the unwrapped value as a JSON number in the `UPDATE` and lets 
the subsequent column retype to `FLOAT` perform the cast — mirroring how the 
PostgreSQL branch defers the cast to its `ALTER ... USING` clause. The 
offline-mode MySQL instructions had the same defect and are corrected too.
   
   Verified on MySQL 8.0: the original SQL reproduces error 3140; the fixed 
`UPDATE` succeeds and the subsequent `MODIFY ... FLOAT` converts the JSON 
numbers to `300`/`60`.
   
   Adds a MySQL-backend regression test that seeds rows and runs the 
migration's own conversion SQL. The existing migration stairway missed this 
because it runs against an empty schema — zero rows updated never trips MySQL's 
per-row JSON validation.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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