diff --git a/django/core/management.py b/django/core/management.py index 26551fdc88..4ca4c9f827 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -883,7 +883,7 @@ def inspectdb(): except NotImplementedError: indexes = {} for i, row in enumerate(introspection_module.get_table_description(cursor, table_name)): - att_name = row[0] + att_name = row[0].lower() comment_notes = [] # Holds Field notes, to be displayed in a Python comment. extra_params = {} # Holds Field parameters such as 'db_column'. diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py index 0f5713f36e..f1fe10b5e8 100644 --- a/django/db/backends/oracle/introspection.py +++ b/django/db/backends/oracle/introspection.py @@ -1,5 +1,7 @@ from django.db.backends.oracle.base import quote_name import re +import cx_Oracle + foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)") @@ -84,19 +86,13 @@ WHERE allcols.column_name = primarycols.column_name (+) AND indexes[row[0]] = {'primary_key': row[1], 'unique': row[2]} return indexes - -# Maps type codes to Django Field types. +# Maps type objects to Django Field types. DATA_TYPES_REVERSE = { - 16: 'BooleanField', - 21: 'SmallIntegerField', - 23: 'IntegerField', - 25: 'TextField', - 869: 'IPAddressField', - 1043: 'CharField', - 1082: 'DateField', - 1083: 'TimeField', - 1114: 'DateTimeField', - 1184: 'DateTimeField', - 1266: 'TimeField', - 1700: 'FloatField', + cx_Oracle.CLOB: 'TextField', + cx_Oracle.DATETIME: 'DateTimeField', + cx_Oracle.FIXED_CHAR: 'CharField', + cx_Oracle.NCLOB: 'TextField', + cx_Oracle.NUMBER: 'FloatField', + cx_Oracle.STRING: 'TextField', + cx_Oracle.TIMESTAMP: 'DateTimeField', }