ephraimbuddy commented on code in PR #61976:
URL: https://github.com/apache/airflow/pull/61976#discussion_r2841054816


##########
airflow-core/src/airflow/migrations/versions/0060_3_0_0_add_try_id_to_ti_and_tih.py:
##########
@@ -158,3 +169,7 @@ def downgrade():
         batch_op.alter_column("id", nullable=False, existing_type=sa.INTEGER)
         batch_op.drop_column("try_id")
         batch_op.create_primary_key("task_instance_history_pkey", ["id"])
+
+    if dialect_name == "mysql":
+        # Restore AUTO_INCREMENT
+        op.execute("ALTER TABLE task_instance_history MODIFY COLUMN id INTEGER 
NOT NULL AUTO_INCREMENT")

Review Comment:
   Unfortunately we don't have options here. It's something that we have to do 
regardless if it would take time for large TIH. 
   One thing though, we should make sure that the next val does not collide by 
setting AUTO_INCREMENT = MAX(id)+1 so the next generated id does not collide



##########
airflow-core/src/airflow/migrations/versions/0060_3_0_0_add_try_id_to_ti_and_tih.py:
##########
@@ -140,6 +140,17 @@ def downgrade():
             ALTER TABLE task_instance_history DROP COLUMN row_num;
         """
         )
+        # Restore the id column's sequence and default
+        op.execute("CREATE SEQUENCE IF NOT EXISTS 
task_instance_history_id_seq")

Review Comment:
   ```suggestion
           op.execute("CREATE SEQUENCE IF NOT EXISTS 
task_instance_history_id_seq OWNED BY task_instance_history.id")
   ```



-- 
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]

Reply via email to