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 inDatabaseIntrospection.get_indexes()
. Starting in
Django 1.7, they added a newget_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 callget_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 |
---|---|
1c0bd629a563828eb12c580de9f1b502e2250ef7 |