Chais commented on code in PR #58149:
URL: https://github.com/apache/airflow/pull/58149#discussion_r2721820350
##########
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:
I was unaware that `op.add_column` behaves differently from
`op.create_table`. More specifically, it ignores the `primary_key` parameter of
the `Column` object, which left the `task_instance_history` table in the
previous version of my patch without a primary key.
I've pushed a change to remedy that. Since alembic/SQLAlchemy don't support
adding a primary key column to an existing table but the database engines do, I
opted for using engine-specific `execute` statements.
--
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]