You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "henry3260 (via GitHub)" <gi...@apache.org> on 2026/08/31 13:20:33 UTC
[PR] Fix misleading error for malformed version in airflow db downgrade [airflow]
henry3260 opened a new pull request, #72331:
URL: https://github.com/apache/airflow/pull/72331
## Why
`airflow db migrate` validates `--to-version` / `--from-version` with `parse_version` before resolving them to an Alembic revision, but `airflow db downgrade` does not. A malformed value therefore falls through to the revision lookup, which fails to parse it and returns `None`, and the user gets:
```
Downgrading to version abc is not supported.
```
That reads as though `abc` is a real version that downgrade refuses to target, pointing users at the docs instead of at their typo. `migrate` reports `Invalid version 'abc' supplied as --to-version.` for the same input.
## What
- `airflow-core/src/airflow/cli/commands/db_command.py`: `run_db_downgrade_command` now validates `--from-version` and `--to-version` with `parse_version` before the revision lookup, raising the same `Invalid version ...` message as `run_db_migrate_command`. The existing `Unknown version` / `not supported` messages are unchanged and now only fire for well-formed versions with no matching revision.
- `airflow-core/tests/unit/cli/commands/test_db_command.py`: added malformed-version cases for both flags at the function and CLI level; the existing CLI case for `not supported` now uses `2.1.25` (well-formed but unknown, matching the `migrate` tests) so that path stays covered.
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [X] Yes - Claude Code
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix misleading error for malformed version in airflow db downgrade [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #72331:
URL: https://github.com/apache/airflow/pull/72331
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org