#32832: AddField migration of TextField and JSONField fails on Django 3.2.X for
MySQL 8.0.19
-------------------------------------+-------------------------------------
               Reporter:  Omkar      |          Owner:  nobody
  Deshpande                          |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  3.2
  Migrations                         |       Keywords:  django, mysql,
               Severity:  Normal     |  textfield, JsonField
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32832>
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/052.e39d79dfd3135f5a2ef07fef31d4385b%40djangoproject.com.

Reply via email to