Code

Ticket #13967: mysql-spatial-index.patch

File mysql-spatial-index.patch, 651 bytes (added by sfllaw, 4 years ago)
  • django/contrib/gis/db/backends/mysql/creation.py

    old new class MySQLCreation(DatabaseCreation): 
    66        from django.contrib.gis.db.models.fields import GeometryField 
    77        output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style) 
    88 
    9         if isinstance(f, GeometryField): 
     9        if isinstance(f, GeometryField) and f.spatial_index: 
    1010            qn = self.connection.ops.quote_name 
    1111            db_table = model._meta.db_table 
    1212            idx_name = '%s_%s_id' % (db_table, f.column)