aneesh-joseph commented on a change in pull request #9973:
URL: https://github.com/apache/airflow/pull/9973#discussion_r598750010



##########
File path: 
airflow/migrations/versions/bbf4a7ad0465_remove_id_column_from_xcom.py
##########
@@ -43,9 +100,14 @@ def upgrade():
     with op.batch_alter_table('xcom') as bop:
         xcom_columns = [col.get('name') for col in 
inspector.get_columns("xcom")]
         if "id" in xcom_columns:
+            if conn.dialect.name == 'mssql':
+                constraint_dict = get_table_constraints(conn, "xcom")
+                drop_column_constraints(bop, 'id', constraint_dict)
             bop.drop_column('id')
             bop.drop_index('idx_xcom_dag_task_date')
-            bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 
'execution_date'])
+            # mssql doesn't allow primary keys with nullable columns
+            if conn.dialect.name != 'mssql':
+                bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 
'execution_date'])

Review comment:
       sure, have added a new migration to make the pkey fields non-nullable




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to