drop get_indexes
This commit is contained in:
parent
5cde8977ef
commit
a0060d3e91
1 changed files with 6 additions and 2 deletions
|
@ -47,7 +47,6 @@ class Command(BaseCommand):
|
||||||
for k, c in contraints.items()
|
for k, c in contraints.items()
|
||||||
if c['index'] or c['primary_key'] or c['unique']
|
if c['index'] or c['primary_key'] or c['unique']
|
||||||
}
|
}
|
||||||
#indexes = connection.introspection.get_indexes(cursor, table)
|
|
||||||
drop = []
|
drop = []
|
||||||
if column in indexes:
|
if column in indexes:
|
||||||
for sql in (
|
for sql in (
|
||||||
|
@ -66,7 +65,12 @@ class Command(BaseCommand):
|
||||||
if options['debug']:
|
if options['debug']:
|
||||||
print(sql)
|
print(sql)
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
indexes = connection.introspection.get_indexes(cursor, table)
|
contraints = connection.introspection.get_constraints(cursor, table)
|
||||||
|
indexes = {
|
||||||
|
','.join(c['columns']): {'primary_key': c['primary_key'], 'unique': c['unique']}
|
||||||
|
for k, c in contraints.items()
|
||||||
|
if c['index'] or c['primary_key'] or c['unique']
|
||||||
|
}
|
||||||
if column not in indexes:
|
if column not in indexes:
|
||||||
create_index("%s_%s_idx" % (table, column), table, column)
|
create_index("%s_%s_idx" % (table, column), table, column)
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
|
|
Loading…
Reference in a new issue