windmark opened a new issue, #26561: URL: https://github.com/apache/airflow/issues/26561
### Apache Airflow version Other Airflow 2 version ### What happened Hi, I'm trying to downgrade the Airflow DB migrations and the [0102_2_3_0_switch_xcom_table_to_use_run_id.py](https://github.dev/apache/airflow/blob/2.3.4/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py#L174) seems to not handle the `xcom_pkey` to `pk_xcom` downgrade properly. This fails in combination with the downgrade of [0060_2_0_0_remove_id_column_from_xcom.py](https://github.dev/apache/airflow/blob/88b274c95b212b541ba19918880ae425856212be/airflow/migrations/versions/0060_2_0_0_remove_id_column_from_xcom.py#L125) since the xcom table does not have an `pk_xcom`. ### What you think should happen instead DB migrations should be compatible with each other and downgrading [0102_2_3_0_switch_xcom_table_to_use_run_id.py](https://github.dev/apache/airflow/blob/2.3.4/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py#L174) should properly recreate the `pk_xcom` it replaces on the upgrade. ### How to reproduce 1. Create an empty Airflow DB with latest migrations of anything >=2.3.0 2. Run `airflow db downgrade --to-revision bbf4a7ad0465` to downgrade to [0060_2_0_0_remove_id_column_from_xcom.py](https://github.dev/apache/airflow/blob/88b274c95b212b541ba19918880ae425856212be/airflow/migrations/versions/0060_2_0_0_remove_id_column_from_xcom.py#L125) The result is the error `constraint "pk_xcom" of relation "xcom" does not exist` when applying the target revision. ### Operating System Linux ### Versions of Apache Airflow Providers ``` apache-airflow==2.3.4 apache-airflow-providers-common-sql==1.2.0 apache-airflow-providers-ftp==3.1.0 apache-airflow-providers-http==4.0.0 apache-airflow-providers-imap==3.0.0 apache-airflow-providers-sqlite==3.2.1 ``` ### Deployment Other 3rd-party Helm chart ### Deployment details _No response_ ### Anything else _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
