You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2021/11/03 21:30:08 UTC

[airflow] 09/17: Fix MySQL db migration with default encoding/collation (#19268)

This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 44caa7ee5a98dafa5879a2560d8a93bc49601f03
Author: Jed Cunningham <66...@users.noreply.github.com>
AuthorDate: Thu Oct 28 12:08:04 2021 -0600

    Fix MySQL db migration with default encoding/collation (#19268)
    
    (cherry picked from commit e76a69b7b14140d0f822e49a3edf4dec6c2780ab)
---
 .../migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py   | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py b/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
index 4676f4a..91acf5e 100644
--- a/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
+++ b/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
@@ -198,6 +198,9 @@ def upgrade():
         if dialect_name == "mysql":
             # Mysql creates an index and a constraint -- we have to drop both
             batch_op.drop_index('task_reschedule_dag_task_date_fkey')
+            batch_op.alter_column(
+                'dag_id', existing_type=sa.String(length=ID_LEN), type_=string_id_col_type, nullable=False
+            )
         batch_op.drop_index('idx_task_reschedule_dag_task_date')
 
     # Then update the new column by selecting the right value from DagRun