3 | | Detected on Django 4.2.8 with PostGIS, but also present on latest main branch. |
| 3 | E.g. starting with the following model |
| 4 | {{{ |
| 5 | class LocationUpdate(models.Model): |
| 6 | location = PointField(geography=True, spatial_index=False) |
| 7 | }}} |
| 8 | |
| 9 | If we change `spatial_index` to `True`, a migration is generated with a single operation: |
| 10 | {{{ |
| 11 | migrations.AlterField( |
| 12 | model_name="locationupdate", |
| 13 | name="location", |
| 14 | field=django.contrib.gis.db.models.fields.PointField( |
| 15 | geography=True, srid=4326 |
| 16 | ), |
| 17 | ) |
| 18 | }}} |
| 19 | |
| 20 | But applying this migration does not create the expected index and the output of `sqlmigrate` is as follows: |
| 21 | {{{ |
| 22 | BEGIN; |
| 23 | -- |
| 24 | -- Alter field location on locationupdate |
| 25 | -- |
| 26 | -- (no-op) |
| 27 | COMMIT; |
| 28 | }}} |
| 29 | |
| 30 | Detected on Django 4.2.8 with PostGIS, but also present on latest main branch across all backends. |