#32503: AlterField migration to TextField with default fails on MySQL 8.0.13+
-------------------------------+------------------------------------
Reporter: Matt Westcott | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 3.0
Severity: Normal | Resolution:
Keywords: mysql default | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Mariusz Felisiak):
* cc: Adam Johnson (added)
* keywords: => mysql default
* stage: Unreviewed => Accepted
Comment:
Thanks for the report, I can reproduce this issue. TBH, I'm not sure why
it doesn't work. I couldn't find any matching caveat in the
[https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html MySQL
docs] , and adding `TextField()` with a default works properly, e.g.
{{{
migrations.AddField(
model_name='mymodel',
name='test_field_2',
field=models.TextField(blank=True, default=''),
)
ALTER TABLE `test_two_mymodel` ADD COLUMN `test_field_2` longtext DEFAULT
('') NOT NULL;
}}}
Crashing SQL:
{{{
ALTER TABLE `test_one_article` ALTER COLUMN `body` SET DEFAULT ('');
}}}
Regression in 6b16c91157512587017e9178d066ed1a683e7795.
--
Ticket URL: <https://code.djangoproject.com/ticket/32503#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.a6359e1a6ac17729bce1f2620b76e748%40djangoproject.com.