1.2.0
Released: September 20, 2019
-
[command] [feature] Added new
--purge
flag to thealembic stamp
command, which will
unconditionally erase the version table before stamping anything. This is
useful for development where non-existent version identifiers might be left
within the table. Additionally,alembic.stamp
now supports a list of
revision identifiers, which are intended to allow setting up muliple heads
at once. Overall handling of version identifiers within the
alembic.stamp
command has been improved with many new tests and
use cases added.References: #473
-
[autogenerate] [bug] Improved the Python rendering of a series of migration operations such that
a single "pass" is rendered for aUpgradeOps
or
DowngradeOps
based on if no lines of Python code actually
rendered under the operation, rather than whether or not sub-directives
exist. Removed extra "pass" lines that would generate from the
ModifyTableOps
directive so that these aren't duplicated under
operation rewriting scenarios.References: #550
-
[feature] [runtime] Added new feature
MigrationContext.autocommit_block()
, a special
directive which will provide for a non-transactional block inside of a
migration script. The feature requres that: the database driver
(e.g. DBAPI) supports the AUTOCOMMIT isolation mode. The directive
also necessarily needs to COMMIT the existing transaction in progress
in order to enter autocommit mode.References: #123
-
[change: py3k] Python 3.4 support is dropped, as the upstream tooling (pip, mysqlclient)
etc are already dropping support for Python 3.4, which itself is no longer
maintained. -
[autogenerate] [usecase] Added autogenerate support for
Column
objects that have
dialect-specific**kwargs
, support first added in SQLAlchemy 1.3.
This includes SQLite "on conflict" as well as options used by some
third party dialects.References: #518
-
[autogenerate] [usecase] Added rendering for SQLAlchemy
Variant
datatypes, which render as the
base type plus one or more.with_variant()
method calls.References: #131
-
[commands] [feature] Added "post write hooks" to revision generation. These allow custom logic
to run after a revision Python script is generated, typically for the
purpose of running code formatters such as "Black" or "autopep8", but may
be used for any arbitrary post-render hook as well, including custom Python
functions or scripts. The hooks are enabled by providing a
[post_write_hooks]
section in the alembic.ini file. A single hook
is provided which runs an arbitrary Python executable on the newly
generated revision script, which can be configured to run code formatters
such as Black; full examples are included in the documentation.References: #307
-
[commands] [usecase] Made the command interface revision lookup behavior more strict in that an
Alembic revision number is only resolved based on a partial match rules if
it has at least four characters, to prevent simple typographical issues
from inadvertently running migrations.References: #534
-
[environment] [feature] Added new flag
--package
toalembic init
. For environments where
the Alembic migration files and such are within the package tree and
importable as modules, this flag can be specified which will add the
additional__init__.py
files in the version location and the
environment location.References: #463
-
[autogenerate] [bug] Fixed bug where rendering of comment text for table-level comments within
Operations.create_table_comment()
and
Operations.drop_table_comment()
was not properly quote-escaped
within rendered Python code for autogenerate.References: #549
-
[autogenerate] [bug] Modified the logic of the
Rewriter
object such that it keeps a
memoization of which directives it has processed, so that it can ensure it
processes a particular directive only once, and additionally fixed
Rewriter
so that it functions correctly for multiple-pass
autogenerate schemes, such as the one illustrated in the "multidb"
template. By tracking which directives have been processed, a
multiple-pass scheme which calls upon theRewriter
multiple times
for the same structure as elements are added can work without running
duplicate operations on the same elements more than once.References: #505