Skip to content

Commit

Permalink
Add --purge flag to the stamp command (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
hurtleturtle authored Mar 9, 2024
1 parent d70e25c commit af67bb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/flask_migrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ def current(directory=None, verbose=False):


@catch_errors
def stamp(directory=None, revision='head', sql=False, tag=None):
def stamp(directory=None, revision='head', sql=False, tag=None, purge=False):
"""'stamp' the revision table with the given revision; don't run any
migrations"""
config = current_app.extensions['migrate'].migrate.get_config(directory)
command.stamp(config, revision, sql=sql, tag=tag)
command.stamp(config, revision, sql=sql, tag=tag, purge=purge)


@catch_errors
Expand Down
7 changes: 5 additions & 2 deletions src/flask_migrate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,15 @@ def current(directory, verbose):
@click.option('--tag', default=None,
help=('Arbitrary "tag" name - can be used by custom env.py '
'scripts'))
@click.option('--purge', is_flag=True,
help=('Delete the version in the alembic_version table before '
'stamping'))
@click.argument('revision', default='head')
@with_appcontext
def stamp(directory, sql, tag, revision):
def stamp(directory, sql, tag, revision, purge):
"""'stamp' the revision table with the given revision; don't run any
migrations"""
_stamp(directory, revision, sql, tag)
_stamp(directory, revision, sql, tag, purge)


@db.command()
Expand Down

0 comments on commit af67bb0

Please sign in to comment.