Use Django's database introspection to scan table indexes.

Review Request #12210 — Created March 25, 2022 and submitted

Information

Django Evolution
release-2.x

Reviewers

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 BaseEvolutionOperations.get_constraints_for_table().
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
going forward.

Unit tests pass for all versions of Python, Django, and all database
types (across major versions of supported databases).

Summary ID
Use Django's database introspection to scan table indexes.
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 `BaseEvolutionOperations.get_constraints_for_table()`. 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 going forward.
1c0bd629a563828eb12c580de9f1b502e2250ef7
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (f7640b7)