Possible bug in AlterField migration with spatial_index

24 views
Skip to first unread message

Arjun Attam

unread,
Aug 31, 2016, 6:33:23 PM8/31/16
to Django users
Hi,

I have a model with a PointField, created with the spatial_index set as True
(the default value). Doing a \d table_name on postgresql revealed the index
that was created, as expected.

I updated the spatial_index to False and ran the migrations, which *did not*
drop the index in the db.

I was also able to repro this with a PointField created with spatial_index as
False. When the field was updated to set spatial_index as True, an index was
not created in the database. Looks like AlterField migration is not working
with PointField and spatial_index.

I'm running Django 1.9.9 and PostgreSQL 9.5.1

Best,
Arjun

Tim Graham

unread,
Aug 31, 2016, 7:56:24 PM8/31/16
to Django users
That looks plausible. The place to patch would probably be https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/schema.py. Could you create a Trac ticket and, if possible, a patch?
Reply all
Reply to author
Forward
0 new messages