def get_sql_indexes_for_model(model):
    "Returns the CREATE INDEX SQL statements for a single model"
    from django.db import backend
    output = []

    for f in model._meta.fields:
        if f.db_index:
            unique = f.unique and 'UNIQUE ' or ''
            output.append(
                style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
                style.SQL_TABLE('%s_%s' % (model._meta.db_table, f.column)) + ' ' + \
                style.SQL_KEYWORD('ON') + ' ' + \
                style.SQL_TABLE(backend.quote_name(model._meta.db_table)) + ' ' + \
                "(%s);" % style.SQL_FIELD(backend.quote_name(f.column))
            )
    return output
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/core/management.py/get_sql_indexes_for_model/original