-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix on clear_number migration script to properly set the default value #34344
Conversation
Can you add a description what this PR is for? Any relation to a bug or feature? |
Sorry about that @jens-scheffler-bosch ! made the requested change. |
tagging @ephraimbuddy @abhishekbhakat and @uranusjr for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the conflicts please?
@phanikumv I've resolved the merge conflict, and tests were passing but 'Mergeable' check was stuck 'In Progress' - triggered another CI run by updating the branch |
if conn.dialect.name == "mssql": | ||
with op.batch_alter_table("dag_run") as batch_op: | ||
batch_op.add_column(sa.Column("clear_number", sa.Integer, default=0)) | ||
batch_op.alter_column("clear_number", existing_type=sa.Integer, nullable=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the issue but this doesn't fixed mssql. Is there a reason why you forked the code to support this?
alter_column can take a 'server_default' value as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed here: https://github.com/apache/airflow/pull/34335/files/ae9920a4be57acf30ee6a7923d3a1e4708a1c36d
Gist: Issue was with downgrade.
closes: #34332
related: #34126
As @abhishekbhakat reported, the merged method of enabling 'default=0' produces an autogenerated sql that causes issues on the db, with nullable=False. 'server_default=0' should be used instead here, but server_default=0 results in the creation of a default DB constraint on MSSQL, which cannot be named deterministically, and hence cannot be removed in the downgrade.