#36806: GeneratedField with null=False creates nullable column on MySQL with
spatial types (POINT)
-------------------------------------+-------------------------------------
Reporter: Dai-Tado | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
**Summary**
GeneratedField ignores null=False on MySQL - columns are always nullable
**Description**
When creating a GeneratedField with null=False on MySQL, the database
column is always created as nullable, ignoring the null=False parameter.
Steps to Reproduce
{{{
pythonfrom django.db import models
class MyModel(models.Model):
area = models.GeneratedField(
.....
null=False, # ← Ignored
)
}}}
- The migration file removes null=False from GeneratedField definition
- Even if manually added to migration file, Django doesn't apply NOT NULL
constraint to database
--
Ticket URL: <
https://code.djangoproject.com/ticket/36806>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.