diff options
author | Tim Graham <timograham@gmail.com> | 2017-09-02 20:28:48 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-09-22 12:51:18 -0400 |
commit | 578711c31052625cc87319cf1c46662c14d75ce9 (patch) | |
tree | 2ed77452adfebe4d8f54066b56bcc8cd11696c85 /django/db/backends/postgresql/introspection.py | |
parent | e62165b898785e890661953c3b2c9c36d98aee57 (diff) | |
download | django-578711c31052625cc87319cf1c46662c14d75ce9.tar.gz |
Refs #27098 -- Removed DatabaseIntrospection.get_indexes() per deprecation timeline.
Diffstat (limited to 'django/db/backends/postgresql/introspection.py')
-rw-r--r-- | django/db/backends/postgresql/introspection.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index 1e987d1779..f060546a53 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -1,10 +1,7 @@ -import warnings - from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.db.models.indexes import Index -from django.utils.deprecation import RemovedInDjango21Warning class DatabaseIntrospection(BaseDatabaseIntrospection): @@ -138,31 +135,6 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): key_columns.extend(cursor.fetchall()) return key_columns - def get_indexes(self, cursor, table_name): - warnings.warn( - "get_indexes() is deprecated in favor of get_constraints().", - RemovedInDjango21Warning, stacklevel=2 - ) - # This query retrieves each index on the given table, including the - # first associated field name - cursor.execute(self._get_indexes_query, [table_name]) - indexes = {} - for row in cursor.fetchall(): - # row[1] (idx.indkey) is stored in the DB as an array. It comes out as - # a string of space-separated integers. This designates the field - # indexes (1-based) of the fields that have indexes on the table. - # Here, we skip any indexes across multiple fields. - if ' ' in row[1]: - continue - if row[0] not in indexes: - indexes[row[0]] = {'primary_key': False, 'unique': False} - # It's possible to have the unique and PK constraints in separate indexes. - if row[3]: - indexes[row[0]]['primary_key'] = True - if row[2]: - indexes[row[0]]['unique'] = True - return indexes - def get_constraints(self, cursor, table_name): """ Retrieve any constraints or keys (unique, pk, fk, check, index) across |