Dev-iL commented on code in PR #69469:
URL: https://github.com/apache/airflow/pull/69469#discussion_r3534623598
##########
airflow-core/src/airflow/migrations/versions/0094_3_2_0_replace_deadline_inline_callback_with_fkey.py:
##########
Review Comment:
**Why editing two already-released migrations is safe and necessary:**
both fixes are purely driver-rendering workarounds, not behavior changes —
verified by running the exact SQLAlchemy constructs used in each migration
against a live Postgres under both drivers. `literal(0)` vs. the original
`literal("0")` persists the identical `integer` value `0` on both psycopg2 and
psycopg3; `CAST(:x AS text)` vs. the original untyped bind param produces the
identical `json_typeof(...) == "string"` value on both drivers (Postgres
already defaulted the untyped psycopg2 param to `text` here, so the explicit
cast just makes psycopg3 resolve it the same way psycopg2 always did). Nothing
downstream — the `dag.max_consecutive_failed_dag_runs` ORM column
(`Mapped[int]`) or the `__classname__`/`prefix` JSON fields consumed via
`import_string()`/deadline callback deserialization — observes any difference.
We also checked for precedent: neither #68314 (explicit psycopg2 scheme) nor
#69089/#684
96 (async driver default) ever touched `migrations/versions/` at all, because
neither ever ran the *synchronous* migration chain under psycopg3 — this PR is
the first change in the repo's history to do that, so there's no established
"never edit released migrations" pattern being broken here, just new territory
the project hasn't hit before.
A corrective migration added at a later version was considered instead of
editing 0017/0094 directly, but doesn't work: Alembic runs the chain
sequentially, so any user upgrading from a pre-0017/pre-0094 revision on
psycopg3 would still crash *at* 0017/0094 before ever reaching a later
corrective migration — the fix has to live at the revision that actually
executes the problematic SQL.
--
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]