1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Make sure we only create the minimum number of table indexes for MySQL.

This patch simplifies a bunch of code for all backends and removes some
duplicate index creation for MySQL, in particular (versions 4.x and later).
Patch from Nis Jørgensen.

Fixed #5671, #5680, #7170, #7186.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7790 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2008-06-30 04:46:59 +00:00
parent b0bc8b9dfd
commit f9df4d1435
8 changed files with 14 additions and 15 deletions

View File

@@ -91,7 +91,7 @@ class Field(object):
self.name = name
self.verbose_name = verbose_name
self.primary_key = primary_key
self.max_length, self.unique = max_length, unique
self.max_length, self._unique = max_length, unique
self.blank, self.null = blank, null
# Oracle treats the empty string ('') as null, so coerce the null
# option whenever '' is a possible value.
@@ -168,6 +168,10 @@ class Field(object):
except KeyError:
return None
def unique(self):
return self._unique or self.primary_key
unique = property(unique)
def validate_full(self, field_data, all_data):
"""
Returns a list of errors for this field. This is the main interface,