You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrated issue, originally created by xealot (@xealot)
Running this command:
$ alembic upgrade head
Alembic correctly starts from the revision which is set in the alembic_version table as expected. However after adding a --sql flag, Alembic no longer attempts to read the version from the DB and so the output is always from the beginning of all migrations.
$ alembic upgrade head --sql
Alternatively when I attempt to use --autogenerate with --sql in some cases I get the error "Database is not up to date". I assume this is because of the same or similar reason.
Am I missing something? Something that makes --sql behave the same as when not using --sql.
The text was updated successfully, but these errors were encountered:
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 When using --sql the current revision seems unknown #248
--autogenerate is an instruction that specifically requires that a database connection is present, so in the absense of very unique customizations to one's env.py, there's no reason you'd want to use --autogenerate with --sql and in fact there's never any reason to use --sql with alembic revision at all; this flag is allowed apparently as a means to help very specific env.py setups.
I didn't actually need the command but I too thought it didn't make sense so I thought I would see what happened. It felt like the same error to me so I mentioned it. My use case is definitely with the update/downgrade command.