diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-05-23 17:02:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 17:02:40 +0200 |
commit | 538bf43458a147b7edeb7118c9f325c3f59ff6fb (patch) | |
tree | a1724f358e8d8829c0c68b1e8bba6882d108fc53 /django/db/backends/oracle/validation.py | |
parent | b3eb6eaf1a197ff155faf333871da032c77ba855 (diff) | |
download | django-538bf43458a147b7edeb7118c9f325c3f59ff6fb.tar.gz |
Fixed #27859 -- Ignored db_index for TextField/BinaryField on Oracle and MySQL.
Thanks Zubair Alam for the initial patch and Tim Graham for the review.
Diffstat (limited to 'django/db/backends/oracle/validation.py')
-rw-r--r-- | django/db/backends/oracle/validation.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/django/db/backends/oracle/validation.py b/django/db/backends/oracle/validation.py new file mode 100644 index 0000000000..e5a35fd3ca --- /dev/null +++ b/django/db/backends/oracle/validation.py @@ -0,0 +1,22 @@ +from django.core import checks +from django.db.backends.base.validation import BaseDatabaseValidation + + +class DatabaseValidation(BaseDatabaseValidation): + def check_field_type(self, field, field_type): + """Oracle doesn't support a database index on some data types.""" + errors = [] + if field.db_index and field_type.lower() in self.connection._limited_data_types: + errors.append( + checks.Warning( + 'Oracle does not support a database index on %s columns.' + % field_type, + hint=( + "An index won't be created. Silence this warning if " + "you don't care about it." + ), + obj=field, + id='fields.W162', + ) + ) + return errors |