MASTREX commented on code in PR #54242:
URL: https://github.com/apache/airflow/pull/54242#discussion_r2388310543
##########
airflow-core/src/airflow/migrations/versions/0068_3_0_0_ti_table_id_unique_per_try.py:
##########
@@ -113,9 +123,24 @@ def downgrade():
existing_nullable=False,
)
batch_op.drop_index("idx_tih_dag_run")
+
# This has to be in a separate batch, else on sqlite it throws
`sqlalchemy.exc.CircularDependencyError`
# (and on non sqlite batching isn't "a thing", it issue alter tables fine)
+
+ task_instance_history = sa.table(
+ "task_instance_history",
+ sa.column("task_instance_id_backup", _get_uuid_type(dialect_name)),
+ )
+ op.execute(
+ task_instance_history.delete().where(
+ task_instance_history.c.task_instance_id_backup.is_(None)
Review Comment:
> Here's my suggestion: on upgrade: Drop the task_instance_id on downgrade:
add task_instance_id as nullable then populate it with TI id from a query if
the TI keys can't be found in TIhistory. After that, lock it back as nullable
=False
Probably current code has the same thing you mentioning(by the PR submitted
after my PR)
I will be closing my PR for now
--
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]