The GitHub Actions job "Tests" on airflow.git/fix/db-clean-dag-version-fK-61390 has failed. Run started by GitHub user Arunodoy18 (triggered by Arunodoy18).
Head commit for run: 0c32bf4c7a506c42e8f99a5d0e63856194d33607 / Arunodoy18 <[email protected]> Fix dag_version FK constraint violation in db cleanup (#61390) The airflow db clean command was failing with FK constraint violations when cleaning the dag_version table. This occurred because the cleanup logic only checked the created_at timestamp, without verifying if dag_version rows were still referenced by task_instance or dag_run tables. Root cause: - task_instance.dag_version_id has FK with ondelete=RESTRICT - dag_run.created_dag_version_id has FK with ondelete=set null - Cleanup tried to delete referenced dag_version rows Solution: - Modified _build_query() to exclude dag_version rows still referenced by task_instance or dag_run using NOT IN subquery - Uses SQLAlchemy, handles NULL values, efficient for large DBs Tests added: - test_dag_version_cleanup_respects_task_instance_fk - test_dag_version_cleanup_deletes_unreferenced_versions - test_dag_version_cleanup_respects_dag_run_fk Closes: #61390 Report URL: https://github.com/apache/airflow/actions/runs/21663582810 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
