Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --purge flag to the stamp command #540

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading