Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#33169 closed Bug (invalid)

Migrations crashes with long identifiers on MySQL (8.0.26 ) — at Version 8

Reported by: Awais Qureshi Owned by: nobody
Component: Migrations Version: 3.2
Severity: Normal Keywords: django32, mysql8.0.26
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Awais Qureshi)

I am trying to upgrade the project from django22 to 32.
Migrate command gives me this error

django.db.utils.OperationalError: (1059, "Identifier name 'blackboard_blackboardlearnerassessmentdatatransmissionaudit_chk_1' is too long")

This issue appeared in django30 also.

I did't find any information related to this change in django32 release notes.

Important point: class BlackboardLearnerAssessmentDataTransmissionAudit(models.Model) is model name and app name is blackboard also.

OS details
mysql Ver 8.0.26-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
Python 3.8
Django 30,31,32

Change History (8)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: needsinfo
Severity: Release blockerNormal
Status: newclosed
Summary: migrations fails to run on django32 with mysql5.7Migrations crashes with long identifiers on MySQL.
Type: UncategorizedBug

Thanks for this report, however I don't think you've explained the issue in enough detail to confirm a bug in Django. blackboard_blackboardlearnerassessmentdatatransmissionaudit_chk_1 is longer than the maximum identifier name on MySQL. Are you using the built-in backend for MySQL? Can you provide a minimum project to reproduce?

I didn't find any information related to this change in django32 release notes.

Have you checked release notes for Django 3.0 and 3.1?

comment:2 by Awais Qureshi, 3 years ago

I am using mysqlclient==2.0.3 and all django defaults packages/backends.

Yes I have checked django30 and 31 release notes, but no information available with this change. Same migration is working fine in django22.

blackboard_blackboardlearnerassessmentdatatransmissionaudit_chk_1 it has 65 characters but seems fine with django22.

comment:3 by Mariusz Felisiak, 3 years ago

... it has 65 characters but seems fine with django22.

This error is not raised by Django, but by MySQL. Can you provide a minimum project to reproduce?

comment:4 by Jacob Walls, 3 years ago

Have you verified the model field referred to is still in your project? I can produce your error if I'm executing a previously written migration but where the field is no longer in my project. Instead, if the field is in my project, I get this upon migrate:

SystemCheckError: System check identified some issues:

ERRORS:
x.xxxx: (models.E018) Autogenerated column name too long for field "blackboard_blackboardlearnerassessmentdatatransmissionaudit_chk_1". Maximum length is "64" for database "default".
        HINT: Set the column name manually using 'db_column'.

This system check predates 2.2, so if the field is in your project and no system check is raised, that would be a false negative to address. But we would need a minimal project to verify that the field exists.

comment:5 by Awais Qureshi, 3 years ago

Description: modified (diff)

comment:6 by Awais Qureshi, 3 years ago

My information was wrong. On githubactions by default mysql is 8.0.26 but on production we have mysql5.7. That was the root cause of the failure.

Field is available and every thing is fine but mysql8 triggers this error and it started appearing in django30 and upper versions.

Thanks for debugging it helps me a-lot to find out the actual root cause. Downgrading mysql to 5.7 fixed the problem.
Updating the ticket description also.

comment:7 by Awais Qureshi, 3 years ago

Description: modified (diff)
Keywords: mysql8.0.26 added
Summary: Migrations crashes with long identifiers on MySQL.Migrations crashes with long identifiers on MySQL (8.0.26 )

comment:8 by Awais Qureshi, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top