diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-23 15:35:12 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-23 15:35:12 -0500 |
commit | 15376ba1d60bc2529f830e8b52fa6b2e9eac29d6 (patch) | |
tree | 35849a199b3612a453d589e3db0039c42f78c9f3 /alembic/command.py | |
parent | 2639f8f5f85294a84414a5adeb8bcce601e8977a (diff) | |
download | alembic-15376ba1d60bc2529f830e8b52fa6b2e9eac29d6.tar.gz |
- The ``alembic revision`` command accepts the ``--sql`` option to
suit some very obscure use case where the ``revision_environment``
flag is set up, so that ``env.py`` is run when ``alembic revision``
is run even though autogenerate isn't specified. As this flag is
otherwise confusing, error messages are now raised if
``alembic revision`` is invoked with both ``--sql`` and
``--autogenerate`` or with ``--sql`` without
``revision_environment`` being set.
fixes #248
Diffstat (limited to 'alembic/command.py')
-rw-r--r-- | alembic/command.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/alembic/command.py b/alembic/command.py index 2bdb944..530af17 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -84,6 +84,10 @@ def revision( if autogenerate: environment = True + if sql: + raise util.CommandError( + "Using --sql with --autogenerate does not make any sense") + def retrieve_migrations(rev, context): if set(script.get_revisions(rev)) != \ set(script.get_revisions("heads")): @@ -93,6 +97,10 @@ def revision( elif environment: def retrieve_migrations(rev, context): return [] + elif sql: + raise util.CommandError( + "Using --sql with the revision command when " + "revision_environment is not configured does not make any sense") if environment: with EnvironmentContext( |