Alembic Versions Save

A database migrations tool for SQLAlchemy.

rel_1_10_2

1 year ago

1.10.2

Released: March 8, 2023

bug

  • [bug] [ops] Fixed regression where Alembic would not run with older SQLAlchemy 1.3 versions prior to 1.3.24 due to a missing symbol. Workarounds have been applied for older 1.3 versions.

    References: #1196

rel_1_10_1

1 year ago

1.10.1

Released: March 6, 2023

bug

  • [bug] [postgresql] Fixed issue regarding PostgreSQL ExcludeConstraint, where constraint elements which made use of literal_column() could not be rendered for autogenerate. Additionally, using SQLAlchemy 2.0.5 or greater, text() constructs are also supported within PostgreSQL ExcludeConstraint objects for autogenerate render. Pull request courtesy Jan Katins.

    References: #1184

  • [bug] [batch] [regression] Fixed regression for 1.10.0 where Constraint objects were suddenly required to have non-None name fields when using batch mode, which was not previously a requirement.

    References: #1195

rel_1_10_0

1 year ago

1.10.0

Released: March 5, 2023

feature

  • [feature] [revisioning] Recursive traversal of revision files in a particular revision directory is now supported, by indicating recursive_version_locations = true in alembic.ini. Pull request courtesy ostr00000.

    References: #760

usecase

  • [usecase] [autogenerate] [postgresql] Added support for autogenerate comparison of indexes on PostgreSQL which include SQL expressions, when using SQLAlchemy 2.0; the previous warning that such indexes were skipped are removed when the new functionality is in use. When using SQLAlchemy versions prior to the 2.0 series, the indexes continue to be skipped with a warning.

bug

  • [bug] [autogenerate] Fixed issue in index detection where autogenerate change detection would consider indexes with the same columns but with different order as equal, while in general they are not equivalent in how a database will use them.

    References: #1166

  • [bug] [autogenerate] [sqlite] Fixed issue where indexes on SQLite which include SQL expressions would not compare correctly, generating false positives under autogenerate. These indexes are now skipped, generating a warning, in the same way that expression-based indexes on PostgreSQL are skipped and generate warnings when SQLAlchemy 1.x installations are in use. Note that reflection of SQLite expression-based indexes continues to not yet be supported under SQLAlchemy 2.0, even though PostgreSQL expression-based indexes have now been implemented.

    References: #1165

  • [bug] [mssql] Properly escape constraint name on SQL Server when dropping a column while specifying mssql_drop_default=True or mssql_drop_check=True or mssql_drop_foreign_key=True.

    References: #1187

rel_1_9_4

1 year ago

1.9.4

Released: February 16, 2023

bug

  • [bug] [mssql] Ongoing fixes for SQL Server server default comparisons under autogenerate, adjusting for SQL Server's collapsing of whitespace between SQL function arguments when reporting on a function-based server default, as well as its arbitrary addition of parenthesis within arguments; the approach has now been made more aggressive by stripping the two default strings to compare of all whitespace, parenthesis, and quoting characters.

    References: #1177

  • [bug] [postgresql] Fixed PostgreSQL server default comparison to handle SQL expressions sent as text() constructs, such as text("substring('name', 1, 3)"), which previously would raise errors when attempting to run a server-based comparison.

  • [bug] [autogenerate] Removed a mis-use of the EnvironmentContext.configure.render_item callable where the "server_default" renderer would be erroneously used within the server default comparison process, which is working against SQL expressions, not Python code.

    References: #1180

  • [bug] [commands] Fixed regression introduced in 1.7.0 where the "config" object passed to the template context when running the merge() command programmatically failed to be correctly populated. Pull request courtesy Brendan Gann.

rel_1_9_3

1 year ago

1.9.3

Released: February 7, 2023

bug

  • [bug] [autogenerate] Fixed issue where rendering of user-defined types that then went onto use the .with_variant() method would fail to render, if using SQLAlchemy 2.0's version of variants.

    References: #1167

rel_1_9_2

1 year ago

1.9.2

Released: January 14, 2023

bug

  • [bug] [typing] Fixed typing definitions for EnvironmentContext.get_x_argument().

    Typing stubs are now generated for overloaded proxied methods such as EnvironmentContext.get_x_argument().

    References: #1146, #1147

  • [bug] [autogenerate] Fixed regression caused by #1145 where the string transformations applied to server defaults caused expressions such as (getdate()) to no longer compare as equivalent on SQL Server, others.

    References: #1152

rel_1_9_1

1 year ago

1.9.1

Released: December 23, 2022

bug

  • [bug] [autogenerate] Fixed issue where server default compare would not work for string defaults that contained backslashes, due to mis-rendering of these values when comparing their contents.

    References: #1145

  • [bug] [oracle] Implemented basic server default comparison for the Oracle backend; previously, Oracle's formatting of reflected defaults prevented any matches from occurring.

  • [bug] [sqlite] Adjusted SQLite's compare server default implementation to better handle defaults with or without parens around them, from both the reflected and the local metadata side.

  • [bug] [mssql] Adjusted SQL Server's compare server default implementation to better handle defaults with or without parens around them, from both the reflected and the local metadata side.

rel_1_9_0

1 year ago

1.9.0

Released: December 15, 2022

feature

  • [feature] [commands] Added new Alembic command alembic check. This performs the widely requested feature of running an "autogenerate" comparison between the current database and the MetaData that's currently set up for autogenerate, returning an error code if the two do not match, based on current autogenerate settings. Pull request courtesy Nathan Louie.

    References: #724

bug

  • [bug] [tests] Fixed issue in tox.ini file where changes in the tox 4.0 series to the format of "passenv" caused tox to not function correctly, in particular raising an error as of tox 4.0.6.

  • [bug] [typing] Fixed typing issue where revision.process_revision_directives was not fully typed; additionally ensured all Callable and Dict arguments to EnvironmentContext.configure() include parameters in the typing declaration.

    Additionally updated the codebase for Mypy 0.990 compliance.

    References: #1110

rel_1_8_1

1 year ago

1.8.1

Released: July 13, 2022

bug

  • [bug] [sqlite] Fixed bug where the SQLite implementation of Operations.rename_table() would render an explicit schema name for both the old and new table name, which while is the standard ALTER syntax, is not accepted by SQLite's syntax which doesn't support a rename across schemas. In particular, the syntax issue would prevent batch mode from working for SQLite databases that made use of attached databases (which are treated as "schemas" in SQLAlchemy).

    References: #1065

  • [bug] [batch] Added an error raise for the condition where Operations.batch_alter_table() is used in --sql mode, where the operation requires table reflection, as is the case when running against SQLite without giving it a fixed Table object. Previously the operation would fail with an internal error. To get a "move and copy" batch operation as a SQL script without connecting to a database, a Table object should be passed to the Operations.batch_alter_table.copy_from parameter so that reflection may be skipped.

    References: #1021

rel_1_8_0

2 years ago

1.8.0

Released: May 31, 2022

changed

  • [changed] [installation] Alembic 1.8 now supports Python 3.7 and above.

    References: #1025

  • [changed] [environment] The "Pylons" environment template has been removed as of Alembic 1.8. This template was based on the very old pre-Pyramid Pylons web framework which has been long superseded by Pyramid.

    References: #987

feature

  • [feature] [typing] PEP 484 typing annotations have been added to the env.py and revision template files within migration templates. Pull request by Nikita Sobolev.

    References: #764

usecase

  • [usecase] [operations] The op.drop_table() operation directive will now trigger the before_drop() and after_drop() DDL event hooks at the table level, which is similar to how the before_create() and after_create() hooks are triggered by the op.create_table() directive. Note that as op.drop_table() accepts only a table name and optional schema name, the Table object received by the event will not have any information within it other than the table name and schema name.

    References: #1037

  • [usecase] [commands] Added new token epoch to the file_template option, which will populate the integer epoch as determined by int(create_date.timestamp()). Pull request courtesy Caio Carvalho.

    References: #1027

bug

  • [bug] [revisioning] Fixed issue where a downgrade using a relative revision would fail in case of multiple branches with a single effectively head due to interdependencies between revisions.

    References: #1026

  • [bug] [batch] Fixed issue in batch mode where CREATE INDEX would not use a new column name in the case of a column rename.

    References: #1034