diff options
Diffstat (limited to 'alembic/runtime/environment.py')
-rw-r--r-- | alembic/runtime/environment.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/alembic/runtime/environment.py b/alembic/runtime/environment.py index f5c177e..71a5309 100644 --- a/alembic/runtime/environment.py +++ b/alembic/runtime/environment.py @@ -108,20 +108,22 @@ class EnvironmentContext(util.ModuleClsProxy): config.set_main_option("script_location", "myapp:migrations") script = ScriptDirectory.from_config(config) + def my_function(rev, context): '''do something with revision "rev", which will be the current database revision, and "context", which is the MigrationContext that the env.py will create''' + with EnvironmentContext( config, script, - fn = my_function, - as_sql = False, - starting_rev = 'base', - destination_rev = 'head', - tag = "sometag" + fn=my_function, + as_sql=False, + starting_rev="base", + destination_rev="head", + tag="sometag", ): script.run_env() |