Use Django's database introspection to scan table indexes.
Review Request #12210 — Created March 25, 2022 and submitted
We've historically had our own table index introspection support, which
was needed for Django 1.6 and earlier due the limited information that
Django returned in
DatabaseIntrospection.get_indexes(). Starting in
Django 1.7, they added a new
get_constraints()method that returned a
lot more information, and in more recent releases (3.2+), this takes
into account information needed for expression-based constraints.
This change adds
It will call
get_constraints()if available, falling back to
get_indexes_for_table()on Django 1.6.
This is fully compatible with our prior logic, and ensures compatibility
Unit tests pass for all versions of Python, Django, and all database
types (across major versions of supported databases).