kaxil commented on issue #20016:
URL: https://github.com/apache/airflow/issues/20016#issuecomment-986736514
### How to downgrade?
Apply this diff and then run `alembic downgrade ccde3e26fe78` from airflow
migrations directory:
```
cd $(python -c "import airflow; import os;
print(os.path.abspath(os.path.join(airflow.__file__, os.pardir)))")
alembic downgrade ccde3e26fe78
```
The Diff:
```diff
diff --git
a/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
b/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
index 25c9aa67a..775d23947 100644
---
a/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
+++
b/airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
@@ -347,12 +347,12 @@ def downgrade():
batch_op.drop_index('idx_task_reschedule_dag_task_run')
with op.batch_alter_table('task_instance', schema=None) as batch_op:
+ batch_op.drop_constraint('task_instance_pkey', type_='primary')
batch_op.alter_column('execution_date', existing_type=dt_type,
existing_nullable=True, nullable=False)
batch_op.alter_column(
'dag_id', existing_type=string_id_col_type,
existing_nullable=True, nullable=True
)
- batch_op.drop_constraint('task_instance_pkey', type_='primary')
batch_op.create_primary_key('task_instance_pkey', ['dag_id',
'task_id', 'execution_date'])
batch_op.drop_constraint('task_instance_dag_run_fkey',
type_='foreignkey')
@@ -416,11 +416,11 @@ def downgrade():
)
else:
with op.batch_alter_table('dag_run', schema=None) as batch_op:
- batch_op.drop_index('dag_id_state', table_name='dag_run')
+ batch_op.drop_index('dag_id_state')
batch_op.alter_column('run_id',
existing_type=sa.VARCHAR(length=250), nullable=True)
batch_op.alter_column('execution_date', existing_type=dt_type,
nullable=True)
batch_op.alter_column('dag_id',
existing_type=sa.VARCHAR(length=250), nullable=True)
- batch_op.create_index('dag_id_state', 'dag_run', ['dag_id',
'state'], unique=False)
+ batch_op.create_index('dag_id_state', ['dag_id', 'state'],
unique=False)
def _multi_table_update(dialect_name, target, column):
diff --git
a/airflow/migrations/versions/e9304a3141f0_make_xcom_pkey_columns_non_nullable.py
b/airflow/migrations/versions/e9304a3141f0_make_xcom_pkey_columns_non_nullable.py
index bde065b3e..1906fe76c 100644
---
a/airflow/migrations/versions/e9304a3141f0_make_xcom_pkey_columns_non_nullable.py
+++
b/airflow/migrations/versions/e9304a3141f0_make_xcom_pkey_columns_non_nullable.py
@@ -70,7 +70,10 @@ def downgrade():
"""Unapply make xcom pkey columns non-nullable"""
conn = op.get_bind()
with op.batch_alter_table('xcom') as bop:
- if conn.dialect.name == 'mssql':
+ try:
bop.drop_constraint('pk_xcom', 'primary')
+ except Exception:
+ pass
bop.alter_column("key", type_=sa.String(length=512,
**COLLATION_ARGS), nullable=True)
bop.alter_column("execution_date", type_=_get_timestamp(conn),
nullable=True)
+ bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key',
'execution_date'])
```
### What's causing the issue?
I am not sure of this currently, any thoughts @jedcunningham @ashb @uranusjr
--
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]