#33169: Migrations crashes with long identifiers on MySQL (8.0.26 ) -------------------------------------+------------------------------------- Reporter: Awais Qureshi | Owner: nobody Type: Bug | Status: closed Component: Migrations | Version: 3.2 Severity: Normal | Resolution: needsinfo Keywords: | Triage Stage: django32,mysql8.0.26 | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Awais Qureshi): It's not a django issue. as per mysql8.0 [https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html] `For constraint definitions that include no constraint name, the server internally generates a name derived from the associated table name. For example, internally generated foreign key and CHECK constraint names consist of the table name plus _ibfk_ or _chk_ and a number. If the table name is close to the length limit for constraint names, the additional characters required for the constraint name may cause that name to exceed the limit, resulting in an error.` My model is as follows class BlackboardLearnerAssessmentDataTransmissionAudit(models.Model): enterprise_course_enrollment_id = models.PositiveIntegerField( blank=False, null=False, db_index=True ) In mysql8 it generate this query with a check `enterprise_cou_enrollment_id` integer UNSIGNED NOT NULL CHECK (`enterprise_cou_enrollment_id` >= 0) having this name `blackboard_blackboardlearnerassessmentdatatransmissionaudit_chk_1` ( 65 characters ) and it throws the error. -- Ticket URL: <https://code.djangoproject.com/ticket/33169#comment:11> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.03891fc5b67432d6ea9b68914742a5fa%40djangoproject.com.