Restore nullable ORM fields and drop unreleased corrective migration#63899
Open
ephraimbuddy wants to merge 1 commit intoapache:mainfrom
Open
Restore nullable ORM fields and drop unreleased corrective migration#63899ephraimbuddy wants to merge 1 commit intoapache:mainfrom
ephraimbuddy wants to merge 1 commit intoapache:mainfrom
Conversation
PR apache#56330 mistakenly changed several ORM-backed columns from nullable to non-nullable. I later added a corrective migration in PR apache#62234 to backfill existing NULLs, but after revisiting the issue we found the migration was only compensating for the nullability mistake introduced by PR apache#56330 itself, which has not been released. Instead of shipping a large corrective migration for an unreleased regression, delete the migration file and restore the affected ORM fields to nullable so the models stay aligned with the actual schema and intended pre-release behavior.
de3ee18 to
f3ecd1b
Compare
ashb
reviewed
Mar 18, 2026
| port: Mapped[int | None] = mapped_column(Integer(), nullable=True) | ||
| is_encrypted: Mapped[bool] = mapped_column(Boolean, unique=False, default=False) | ||
| is_extra_encrypted: Mapped[bool] = mapped_column(Boolean, unique=False, default=False) | ||
| is_encrypted: Mapped[bool | None] = mapped_column(Boolean, unique=False, default=False) |
Member
There was a problem hiding this comment.
These could be left non nullable - false and not null are equivalent for where is used
Member
There was a problem hiding this comment.
I think the problem is the field was nullable in 2.2.x (and earlier), and changing this to non-nullable without a migration will cause problems if there are nulls in the db.
| # Set this default value of is_paused based on a configuration value! | ||
| is_paused_at_creation = airflow_conf.getboolean("core", "dags_are_paused_at_creation") | ||
| is_paused: Mapped[bool] = mapped_column(Boolean, default=is_paused_at_creation) | ||
| is_paused: Mapped[bool | None] = mapped_column(Boolean, default=is_paused_at_creation) |
Member
There was a problem hiding this comment.
Ditto here - null = false = not paused
| id: Mapped[int] = mapped_column(Integer, primary_key=True) | ||
| key: Mapped[str] = mapped_column(String(ID_LEN), unique=True) | ||
| _val: Mapped[str] = mapped_column("val", Text().with_variant(MEDIUMTEXT, "mysql")) | ||
| key: Mapped[str | None] = mapped_column(String(ID_LEN), unique=True, nullable=True) |
Member
There was a problem hiding this comment.
Same here, yes it shouldn’t be nullable, but it was, and there’s no way to fix this now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #56330 mistakenly changed several ORM-backed columns from nullable to non-nullable. I later added a corrective migration in PR #62234 to backfill existing NULLs, but after revisiting the issue we found the migration was only compensating for the nullability mistake introduced by PR #56330 itself, which has not been released.
Instead of shipping a large corrective migration for an unreleased regression, delete the migration file and restore the affected ORM fields to nullable so the models stay aligned with the actual schema and intended pre-release behavior.