• 
      

    Use Django's database introspection to scan table indexes.

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

    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).

    Commits

    Files