Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@vinthara
Copy link

@vinthara vinthara commented Dec 19, 2025

Description

Issue 1222

Possibility to add a --reversed flag, which will list the history from base to head
When doing alembic history -R or alembic history --reversed

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • No tests added

For example :

alembic history 

Outputs :

7acb31ef52a9 -> af14eef641e8 (head), third migration
efe3dda2d3da -> 7acb31ef52a9, second migration
<base> -> efe3dda2d3da, first migration

For example :

alembic history --reversed

Output :

<base> -> efe3dda2d3da, first migration
efe3dda2d3da -> 7acb31ef52a9, second migration
7acb31ef52a9 -> af14eef641e8 (head), third migration

For example :

alembic history -h

Output :

usage: alembic history [-h] [-r REV_RANGE] [-v] [-i] [-R]

options:
  -h, --help            show this help message and exit
  -r, --rev-range REV_RANGE
                        Specify a revision range; format is [start]:[end]
  -v, --verbose         Use more verbose output
  -i, --indicate-current
                        Indicate the current revision
  -R, --reversed        Show the history in the reversed order

Have a nice day!

Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change looks fine to me. thanks!

For the test there are already history tests that you can likely extend to test for the reversed flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.