]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
Improved support for expression indexes
authorCaselIT <cfederico87@gmail.com>
Sat, 4 Feb 2023 12:28:42 +0000 (13:28 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Feb 2023 15:33:29 +0000 (10:33 -0500)
commit5c71fd120af824d289cf72dd4b5679a4f839a1eb
treeb373439e832f57841c9f0611232e8524aca70b2d
parentcbc13309a154dd59ae428f14fa2e7340a5fcb6fc
Improved support for expression indexes

Added support for autogenerate comparison of indexes on PostgreSQL which
include SQL expressions; the previous warning that such indexes were
skipped is now removed. This functionality requires SQLAlchemy 2.0.
For older SQLAlchemy versions, these indexes are still skipped.

Fixed issue where indexes on SQLite which include SQL expressions would not
compare against themselves correctly, generating false positives.
SQLAlchemy as of version 2 has no support for reflecting expression based
indexes on SQLite; so for now, the behavior is that SQLite expression-based
indexes are ignored for autogenerate compare, in the same way that
PostgreSQL expression-based indexes were ignored for the time that
SQLAlchemy did not support reflection of such indexes (which is now
supported in SQLAlchemy 2.0 as well as this release of Alembic).

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.

Fixes: #1165
Fixes: #1166
Change-Id: I226408eed855b923172e5df0bdab005ed2cc9f53
17 files changed:
alembic/autogenerate/compare.py
alembic/ddl/impl.py
alembic/ddl/postgresql.py
alembic/ddl/sqlite.py
alembic/testing/requirements.py
alembic/testing/schemacompare.py
alembic/testing/util.py
alembic/util/__init__.py
alembic/util/sqla_compat.py
docs/build/unreleased/1165.rst [new file with mode: 0644]
docs/build/unreleased/1166.rst [new file with mode: 0644]
docs/build/unreleased/index_updates.rst [new file with mode: 0644]
setup.cfg
tests/requirements.py
tests/test_autogen_indexes.py
tests/test_postgresql.py
tests/test_sqlite.py