You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ephraimbuddy (via GitHub)" <gi...@apache.org> on 2025/12/02 11:00:49 UTC
Re: [PR] Reinstate tih.id as pkey and auto-increment on downgrade [airflow]
ephraimbuddy commented on code in PR #58149:
URL: https://github.com/apache/airflow/pull/58149#discussion_r2580682325
##########
airflow-core/src/airflow/migrations/versions/0060_3_0_0_add_try_id_to_ti_and_tih.py:
##########
@@ -127,34 +127,8 @@ def upgrade():
def downgrade():
"""Unapply Add try_id to TI and TIH."""
- dialect_name = op.get_bind().dialect.name
with op.batch_alter_table("task_instance_history", schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f("task_instance_history_pkey"), type_="primary")
- batch_op.add_column(sa.Column("id", sa.INTEGER, nullable=True))
+ batch_op.add_column(sa.Column("id", sa.INTEGER, primary_key=True, autoincrement=True))
Review Comment:
This won't work with data as id would be null.
That's why we had to run the deleted statements to update the ID column before making it a primary key
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org