| 1 |
from django.core import checks |
| 2 |
from django.db.backends.base.validation import BaseDatabaseValidation |
| 3 |
|
| 4 |
|
| 5 |
class DatabaseValidation(BaseDatabaseValidation): |
| 6 |
def check_field_type(self, field, field_type): |
| 7 |
"""Oracle doesn't support a database index on some data types.""" |
| 8 |
errors = [] |
| 9 |
if field.db_index and field_type.lower() in self.connection._limited_data_types: |
| 10 |
errors.append( |
| 11 |
checks.Warning( |
| 12 |
"Oracle does not support a database index on %s columns." |
| 13 |
% field_type, |
| 14 |
hint=( |
| 15 |
"An index won't be created. Silence this warning if " |
| 16 |
"you don't care about it." |
| 17 |
), |
| 18 |
obj=field, |
| 19 |
id="fields.W162", |
| 20 |
) |
| 21 |
) |
| 22 |
return errors |