﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32832	Adding nullable TextField/JSONField with default fails on MySQL 8.0.13+.	Omkar Deshpande	Mariusz Felisiak	"Versions Involved:

Django: 3.2.4
Python: 3.8.7
MySQL: 8.0.19
OS: CentOS 7

----

Referenced:

Ticket: https://code.djangoproject.com/ticket/32503
PR: https://github.com/django/django/pull/14421
Commit: https://github.com/django/django/pull/14421/commits/5e04e84d67da8163f365e9f5fcd169e2630e2873

----
New project used for reproducing the error:

Project: https://github.com/omkar-dsd/almanac

----

Error:

{{{
django.db.utils.OperationalError: (1101, ""BLOB, TEXT, GEOMETRY or JSON column 'new_txt' can't have a default value"")
}}}

Occurred on migration:

{{{
migrations.AddField(
            model_name='nucleusdata',
            name='new_txt',
            field=models.TextField(blank=True, default='abc', null=True),
        )
}}}


----

How to reproduce:

1. Add new TextField or JSONField with default on pre-existing model, with Django < 3.2
2. Upgrade Django version to 3.2.4
3. Run migration which involves creation of of the new field added in step 1.

----

Details:

This occurs for all JSON and Text Fields with default value.

This occurred to me when I upgraded from Django 2.2.24 to 3.2.4 and ran migrations on fresh DB.
This error did not occur when upgraded from Django 2.2.24 to 3.1.12. And, it occurs for all 3.2.X till date.
New project was created to demonstrate the issue it available on the above GitHub link for reference.

"	Bug	closed	Migrations	3.2	Release blocker	fixed	django, mysql, textfield, JsonField	Adam Johnson Mariusz Felisiak Simon Charette Jordan Bae	Accepted	1	0	0	0	0	0
