Releases: sqlalchemy/alembic
0.9.0
0.9.0
Released: February 28, 2017
-
[autogenerate] [feature] The
EnvironmentContext.configure.target_metadata
parameter
may now be optionally specified as a sequence ofMetaData
objects instead of a singleMetaData
object. The
autogenerate process will process the sequence ofMetaData
objects in order.References: #38
-
[bug] [commands] A
CommandError
is now raised when a migration file opens
a database transaction and does not close/commit/rollback, when
the backend database or environment options also specify transactional_ddl
is False. When transactional_ddl is not in use, Alembic doesn't
close any transaction so a transaction opened by a migration file
will cause the following migrations to fail to apply.References: #369
-
[autogenerate] [bug] [mysql] The
autoincrement=True
flag is now rendered within the
Operations.alter_column()
operation if the source column indicates
that this flag should be set to True. The behavior is sensitive to
the SQLAlchemy version in place, as the "auto" default option is new
in SQLAlchemy 1.1. When the source column indicates autoincrement
as True or "auto", the flag will render as True if the original column
contextually indicates that it should have "autoincrement" keywords,
and when the source column explcitly sets it to False, this is also
rendered. The behavior is intended to preserve the AUTO_INCREMENT flag
on MySQL as the column is fully recreated on this backend. Note that this
flag does not support alteration of a column's "autoincrement" status,
as this is not portable across backends.References: #413
-
[bug] [postgresql] Fixed bug where Postgresql JSON/JSONB types rendered on SQLAlchemy
1.1 would render the "astext_type" argument which defaults to
theText()
type without the module prefix, similarly to the
issue with ARRAY fixed in #85.References: #411
-
[bug] [postgresql] Fixed bug where Postgresql ARRAY type would not render the import prefix
for the inner type; additionally, user-defined renderers take place
for the inner type as well as the outer type. Pull request courtesy
Paul Brackin.References: #85
-
[autogenerate] [feature] Added a keyword argument
process_revision_directives
to the
command.revision()
API call. This function acts in the
same role as the environment-level
EnvironmentContext.configure.process_revision_directives
,
and allows API use of the
command to drop in an ad-hoc directive process function. This
function can be used among other things to place a complete
MigrationScript
structure in place. -
[feature] [postgresql] Added support for Postgresql EXCLUDE constraints, including the
operation directiveOperations.create_exclude_constraints()
as well as autogenerate render support for theExcludeConstraint
object as present in aTable
. Autogenerate detection for an EXCLUDE
constraint added or removed to/from an existing table is not
implemented as the SQLAlchemy Postgresql dialect does not yet support
reflection of EXCLUDE constraints.Additionally, unknown constraint types now warn when
encountered within an autogenerate action rather than raise.References: #412
-
[bug] [operations] Fixed bug in
ops.create_foreign_key()
where the internal table
representation would not be created properly if the foriegn key referred
to a table in a different schema of the same name. Pull request
courtesy Konstantin Lebedev.
0.8.10
0.8.10
Released: January 17, 2017
-
[bug] [versioning] The alembic_version table, when initially created, now establishes a
primary key constraint on the "version_num" column, to suit database
engines that don't support tables without primary keys. This behavior
can be controlled using the parameter
EnvironmentContext.configure.version_table_pk
. Note that
this change only applies to the initial creation of the alembic_version
table; it does not impact any existing alembic_version table already
present.References: #406
-
[batch] [bug] Fixed bug where doing
batch_op.drop_constraint()
against the
primary key constraint would fail to remove the "primary_key" flag
from the column, resulting in the constraint being recreated.References: #402
-
[autogenerate] [bug] [oracle] Adjusted the logic originally added for #276 that detects MySQL
unique constraints which are actually unique indexes to be generalized
for any dialect that has this behavior, for SQLAlchemy version 1.0 and
greater. This is to allow for upcoming SQLAlchemy support for unique
constraint reflection for Oracle, which also has no dedicated concept of
"unique constraint" and instead establishes a unique index. -
[bug] [versioning] Added a file ignore for Python files of the form
.#<name>.py
,
which are generated by the Emacs editor. Pull request courtesy
Markus Mattes.References: #356
0.8.9
0.8.9
Released: November 28, 2016
-
[autogenerate] [bug] Adjustment to the "please adjust!" comment in the script.py.mako
template so that the generated comment starts with a single pound
sign, appeasing flake8.References: #393
-
[batch] [bug] Batch mode will not use CAST() to copy data if type_ is given, however
the basic type affinity matches that of the existing type. This to
avoid SQLite's CAST of TIMESTAMP which results in truncation of the
data, in those cases where the user needs to add redundant type_ for
other reasons.References: #391
-
[autogenerate] [bug] Continued pep8 improvements by adding appropriate whitespace in
the base template for generated migrations. Pull request courtesy
Markus Mattes.References: #393
-
[bug] [revisioning] Added an additional check when reading in revision files to detect
if the same file is being read twice; this can occur if the same directory
or a symlink equivalent is present more than once in version_locations.
A warning is now emitted and the file is skipped. Pull request courtesy
Jiri Kuncar. -
[autogenerate] [bug] Fixed bug where usage of a custom TypeDecorator which returns a
per-dialect type viaTypeDecorator.load_dialect_impl()
that differs
significantly from the default "impl" for the type decorator would fail
to compare correctly during autogenerate.References: #395
-
[autogenerate] [bug] [postgresql] Fixed bug in Postgresql "functional index skip" behavior where a
functional index that ended in ASC/DESC wouldn't be detected as something
we can't compare in autogenerate, leading to duplicate definitions
in autogenerated files.References: #392
-
[bug] [versioning] Fixed bug where the "base" specifier, as in "base:head", could not
be used explicitly when--sql
mode was present.
0.8.8
0.8.8
Released: September 12, 2016
-
[autogenerate] The imports in the default script.py.mako are now at the top
so that flake8 editors don't complain by default. PR courtesy
Guilherme Mansur. -
[feature] [operations] [postgresql] Added support for the USING clause to the ALTER COLUMN operation
for Postgresql. Support is via the
op.alter_column.postgresql_using
parameter. Pull request courtesy Frazer McLean.References: #292
-
[autogenerate] [feature] Autogenerate with type comparison enabled will pick up on the timezone
setting changing between DateTime types. Pull request courtesy
David Szotten.
0.8.7
0.8.7
Released: July 26, 2016
-
[bug] [versioning] Fixed bug where upgrading to the head of a branch which is already
present would fail, only if that head were also the dependency
of a different branch that is also upgraded, as the revision system
would see this as trying to go in the wrong direction. The check
here has been refined to distinguish between same-branch revisions
out of order vs. movement along sibling branches.References: #336
-
[bug] [versioning] Adjusted the version traversal on downgrade
such that we can downgrade to a version that is a dependency for
a version in a different branch, without needing to remove that
dependent version as well. Previously, the target version would be
seen as a "merge point" for it's normal up-revision as well as the
dependency. This integrates with the changes for #377
and #378 to improve treatment of branches with dependencies
overall.References: #379
-
[bug] [versioning] Fixed bug where a downgrade to a version that is also a dependency
to a different branch would fail, as the system attempted to treat
this as an "unmerge" of a merge point, when in fact it doesn't have
the other side of the merge point available for update.References: #377
-
[bug] [versioning] Fixed bug where the "alembic current" command wouldn't show a revision
as a current head if it were also a dependency of a version in a
different branch that's also applied. Extra logic is added to
extract "implied" versions of different branches from the top-level
versions listed in the alembic_version table.References: #378
-
[bug] [versioning] Fixed bug where a repr() or str() of a Script object would fail
if the script had multiple dependencies. -
[autogenerate] [bug] Fixed bug in autogen where if the DB connection sends the default
schema as "None", this "None" would be removed from the list of
schemas to check if include_schemas were set. This could possibly
impact using include_schemas with SQLite. -
[batch] [bug] Small adjustment made to the batch handling for reflected CHECK
constraints to accommodate for SQLAlchemy 1.1 now reflecting these.
Batch mode still does not support CHECK constraints from the reflected
table as these can't be easily differentiated from the ones created
by types such as Boolean.
0.8.6
0.8.6
Released: April 14, 2016
-
[bug] [commands] Errors which occur within the Mako render step are now intercepted
and raised as CommandErrors like other failure cases; the Mako
exception itself is written using template-line formatting to
a temporary file which is named in the exception message.References: #367
-
[bug] [postgresql] Added a fix to Postgresql server default comparison which first checks
if the text of the default is identical to the original, before attempting
to actually run the default. This accomodates for default-generation
functions that generate a new value each time such as a uuid function.References: #365
-
[batch] [bug] Fixed bug introduced by the fix for #338 in version 0.8.4
where a server default could no longer be dropped in batch mode.
Pull request courtesy Martin Domke.References: #361
-
[batch] [bug] [mssql] Fixed bug where SQL Server arguments for drop_column() would not
be propagated when running under a batch block. Pull request
courtesy Michal Petrucha.
0.8.5
0.8.5
Released: March 9, 2016
-
[autogenerate] [bug] Fixed bug where the columns rendered in a
PrimaryKeyConstraint
in autogenerate would inappropriately render the "key" of the
column, not the name. Pull request courtesy Jesse Dhillon.References: #335
-
[batch] [bug] Repaired batch migration support for "schema" types which generate
constraints, in particular theBoolean
datatype which generates
a CHECK constraint. Previously, an alter column operation with this
type would fail to correctly accommodate for the CHECK constraint
on change both from and to this type. In the former case the operation
would fail entirely, in the latter, the CHECK constraint would
not get generated. Both of these issues are repaired.References: #354
-
[bug] [mysql] Changing a schema type such as
Boolean
to a non-schema type would
emit a drop constraint operation which emitsNotImplementedError
for
the MySQL dialect. This drop constraint operation is now skipped when
the constraint originates from a schema type.References: #355
0.8.4
0.8.4
Released: December 15, 2015
-
[feature] [versioning] A major improvement to the hash id generation function, which for some
reason used an awkward arithmetic formula against uuid4() that produced
values that tended to start with the digits 1-4. Replaced with a
simple substring approach which provides an even distribution. Pull
request courtesy Antti Haapala. -
[autogenerate] [feature] Added an autogenerate renderer for the
ExecuteSQLOp
operation
object; only renders if given a plain SQL string, otherwise raises
NotImplementedError. Can be of help with custom autogenerate
sequences that includes straight SQL execution. Pull request courtesy
Jacob Magnusson. -
[batch] [bug] Batch mode generates a FOREIGN KEY constraint that is self-referential
using the ultimate table name, rather than_alembic_batch_temp
.
When the table is renamed from_alembic_batch_temp
back to the
original name, the FK now points to the right name. This
will not work if referential integrity is being enforced (eg. SQLite
"PRAGMA FOREIGN_KEYS=ON") since the original table is dropped and
the new table then renamed to that name, however this is now consistent
with how foreign key constraints on other tables already operate
with batch mode; these don't support batch mode if referential integrity
is enabled in any case.References: #345
-
[autogenerate] [bug] Added a type-level comparator that distinguishes
Integer
,
BigInteger
, andSmallInteger
types and
dialect-specific types; these all have "Integer" affinity so previously
all compared as the same.References: #341
-
[batch] [bug] Fixed bug where the
server_default
parameter ofalter_column()
would not function correctly in batch mode.References: #338
-
[autogenerate] [bug] Adjusted the rendering for index expressions such that a
Column
object present in the sourceIndex
will not be rendered
as table-qualified; e.g. the column name will be rendered alone.
Table-qualified names here were failing on systems such as Postgresql.References: #337
0.8.3
0.8.3
Released: October 16, 2015
-
[autogenerate] [bug] Fixed an 0.8 regression whereby the "imports" dictionary member of
the autogen context was removed; this collection is documented in the
"render custom type" documentation as a place to add new imports.
The member is now known as
AutogenContext.imports
and the documentation is repaired.References: #332
-
[batch] [bug] Fixed bug in batch mode where a table that had pre-existing indexes
would create the same index on the new table with the same name,
which on SQLite produces a naming conflict as index names are in a
global namespace on that backend. Batch mode now defers the production
of both existing and new indexes until after the entire table transfer
operation is complete, which also means those indexes no longer take
effect during the INSERT from SELECT section as well; the indexes
are applied in a single step afterwards.References: #333
-
[bug] [tests] Added "pytest-xdist" as a tox dependency, so that the -n flag
in the test command works if this is not already installed.
Pull request courtesy Julien Danjou. -
[autogenerate] [bug] [postgresql] Fixed issue in PG server default comparison where model-side defaults
configured with Python unicode literals would leak the "u" character
from arepr()
into the SQL used for comparison, creating an invalid
SQL expression, as the server-side comparison feature in PG currently
repurposes the autogenerate Python rendering feature to get a quoted
version of a plain string default.References: #324
0.8.2
0.8.2
Released: August 25, 2015
-
[autogenerate] [bug] Added workaround in new foreign key option detection feature for
MySQL's consideration of the "RESTRICT" option being the default,
for which no value is reported from the database; the MySQL impl now
corrects for when the model reports RESTRICT but the database reports
nothing. A similar rule is in the default FK comparison to accommodate
for the default "NO ACTION" setting being present in the model but not
necessarily reported by the database, or vice versa.References: #321