Ticket #15933: django_mysql4_multiple_keys_keep_primary.diff
File django_mysql4_multiple_keys_keep_primary.diff, 802 bytes (added by , 14 years ago) |
---|
-
django/db/backends/mysql/introspection.py
93 93 cursor.execute("SHOW INDEX FROM %s" % self.connection.ops.quote_name(table_name)) 94 94 indexes = {} 95 95 for row in cursor.fetchall(): 96 indexes[row[4]] = {'primary_key': (row[2] == 'PRIMARY'), 'unique': not bool(row[1])} 96 if indexes.has_key(row[4]) and indexes[row[4]]['primary_key'] == True: 97 indexes[row[4]]['unique'] = not bool(row[1]) 98 else: 99 indexes[row[4]] = {'primary_key': (row[2] == 'PRIMARY'), 'unique': not bool(row[1])} 97 100 return indexes 98 101