diff --git a/flask_migrate/__init__.py b/flask_migrate/__init__.py index dfe0ac3..1744642 100755 --- a/flask_migrate/__init__.py +++ b/flask_migrate/__init__.py @@ -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, @@ -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) diff --git a/flask_migrate/cli.py b/flask_migrate/cli.py index 01dfe5b..e8fcd38 100644 --- a/flask_migrate/cli.py +++ b/flask_migrate/cli.py @@ -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()