From: Mike Bayer Date: Tue, 19 Apr 2011 18:10:52 +0000 (-0400) Subject: add a stamp command X-Git-Tag: rel_0_1_0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=697d3b9cfbed90c413a4004ae3be6a72139ae638;p=thirdparty%2Fsqlalchemy%2Falembic.git add a stamp command --- diff --git a/alembic/command.py b/alembic/command.py index f1d50006..db730168 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -120,6 +120,25 @@ def current(config): ) script.run_env() +def stamp(config, revision, sql=False): + """'stamp' the revision table with the given revision; don't + run any migrations.""" + + script = ScriptDirectory.from_config(config) + def do_stamp(rev): + current = context.get_context()._current_rev() + dest = script._get_rev(revision) + if dest is not None: + dest = dest.revision + context.get_context()._update_current_rev(current, dest) + return [] + context.opts( + config, + fn = do_stamp, + as_sql = sql, + ) + script.run_env() + def splice(config, parent, child): """'splice' two branches, creating a new revision file."""