Modify

Ticket #703 (assigned defect)

Opened 3 years ago

Last modified 3 years ago

South does not seem to pick up "spatial_index" and "db_index" params for GeoDjango's geometry fields

Reported by: regs@… Owned by: andrew
Priority: trivial Milestone: 1.0
Component: migrations Version: 0.7.3
Keywords: geodjango Cc:

Description

South does not seem to add db_index and spatial_index parameters for GeometryField? descendants.

I'm creating my tables using MySQL InnoDB, which does not support spatial indexing. However, the default option for GeometryField?-s is to create one - spatial_index=True.

Example:

class Model1(models.Model):
    location = models.PointField(blank=True, null=True, db_index=False, spatial_index=False

$ ./manage.py schemamigration myapp --initial

migration created :

db.create_table('myapp_model1', (
    ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
    ('location', self.gf('django.contrib.gis.db.models.fields.PointField')(null=True, blank=True)),

When I try to apply the migration, MySQL blows up with an exception that SPATIAL_INDEX is not allowed - both because I'm using InnoDB, and because my field is null=True.

The workaround was to manually add the spatial_index=False option to the migration:

    ('location', self.gf('django.contrib.gis.db.models.fields.PointField')(null=True, blank=True, spatial_index=False)),

---

MacOS 10.6.6
MySQL 5.5.8
Django 1.2.4
South 0.7.3

---

Other than that - congratulations! - you guys did a great job :o)

Cheers,
Boris

Attachments

Change History

comment:1 Changed 3 years ago by andrew

  • Status changed from new to assigned
  • Version changed from unknown to 0.7.3
  • Milestone set to 1.0

Ah, a slight mismatch there in the introspector or something, perhaps. I'll have to replicate this locally, so a fix may be a short while, but if the workaround works, that's something at least.

View

Add a comment

Modify Ticket

Action
as assigned
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.