Skip to content

Commit

Permalink
Add indicate-current option into history command (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
misebox authored and miguelgrinberg committed Sep 18, 2018
1 parent bdce823 commit 1fa1936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions flask_migrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ def show(directory=None, revision='head'):
raise RuntimeError('Alembic 0.7.0 or greater is required')


@MigrateCommand.option('-i', '--indicate-current', dest='indicate_current', action='store_true',
default=False, help='Indicate current version (Alembic 0.9.9 or greater is required)')
@MigrateCommand.option('-v', '--verbose', dest='verbose', action='store_true',
default=False, help='Use more verbose output')
@MigrateCommand.option('-r', '--rev-range', dest='rev_range', default=None,
Expand All @@ -328,10 +330,12 @@ def show(directory=None, revision='head'):
help=("migration script directory (default is "
"'migrations')"))
@catch_errors
def history(directory=None, rev_range=None, verbose=False):
def history(directory=None, rev_range=None, verbose=False, indicate_current=False):
"""List changeset scripts in chronological order."""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
if alembic_version >= (0, 9, 9):
command.history(config, rev_range, verbose=verbose, indicate_current=indicate_current)
elif alembic_version >= (0, 7, 0):
command.history(config, rev_range, verbose=verbose)
else:
command.history(config, rev_range)
Expand Down
5 changes: 3 additions & 2 deletions flask_migrate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ def show(directory, revision):
@click.option('-r', '--rev-range', default=None,
help='Specify a revision range; format is [start]:[end]')
@click.option('-v', '--verbose', is_flag=True, help='Use more verbose output')
@click.option('-i', '--indicate-current', is_flag=True, help='Indicate current version (Alembic 0.9.9 or greater is required)')
@with_appcontext
def history(directory, rev_range, verbose):
def history(directory, rev_range, verbose, indicate_current):
"""List changeset scripts in chronological order."""
_history(directory, rev_range, verbose)
_history(directory, rev_range, verbose, indicate_current)


@db.command()
Expand Down

0 comments on commit 1fa1936

Please sign in to comment.