|
@@ -258,20 +258,20 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
|
|
# Now get indexes
|
|
|
cursor.execute("""
|
|
|
SELECT
|
|
|
- index_name,
|
|
|
- LOWER(column_name), descend
|
|
|
+ cols.index_name, LOWER(cols.column_name), cols.descend,
|
|
|
+ LOWER(ind.index_type)
|
|
|
FROM
|
|
|
- user_ind_columns cols
|
|
|
+ user_ind_columns cols, user_indexes ind
|
|
|
WHERE
|
|
|
- table_name = UPPER(%s) AND
|
|
|
+ cols.table_name = UPPER(%s) AND
|
|
|
NOT EXISTS (
|
|
|
SELECT 1
|
|
|
FROM user_constraints cons
|
|
|
WHERE cols.index_name = cons.index_name
|
|
|
- )
|
|
|
+ ) AND cols.index_name = ind.index_name
|
|
|
ORDER BY cols.column_position
|
|
|
""", [table_name])
|
|
|
- for constraint, column, order in cursor.fetchall():
|
|
|
+ for constraint, column, order, type_ in cursor.fetchall():
|
|
|
# If we're the first column, make the record
|
|
|
if constraint not in constraints:
|
|
|
constraints[constraint] = {
|
|
@@ -282,6 +282,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
|
|
"foreign_key": None,
|
|
|
"check": False,
|
|
|
"index": True,
|
|
|
+ "type": 'btree' if type_ == 'normal' else type_,
|
|
|
}
|
|
|
# Record the details
|
|
|
constraints[constraint]['columns'].append(column)
|