I am trying to convert my MultiPolygonField field from this:
multipolygon = MultiPolygonField(null=True)
to this:
multipolygon = MultiPolygonField(null=False)
It looks simple, so I execute "makemigrations" and I get the usual message warning that the database needs something to populate existing rows (I confirmed that there is no row in my database with that field being null):
Whether I choose option 1:
- Provide a one-off default now (will be set on all existing rows with a null value for this column)
And set the following as default:
'SRID=3857;POINT(0.0 0.0)'
or option 2:
- Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation
I get the following error when I execute "migrate":
ValueError: Cannot alter field borders.Border.multipolygon into borders.Border.multipolygon - they do not properly define db_type (are you using a badly-written custom field?)
I have been able to make that same change with other simpler field types without any issue. How to do this with MultiPolygonFields? I am using Django 4 and sqlite 3.31, in case that matters.