#24410: MySQL manually created indexes aren't recognized -------------------------------+-------------------- Reporter: karolyi | Owner: nobody Type: Uncategorized | Status: new Component: Uncategorized | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- Hey,
Using Django 1.7's migrations with MySQL, when I need to create a custom index on a column (`Specified key was too long; max key length is 767 bytes`, thus the column needs a prefix length), it's not recognized, not deleted when migrating backwards and the erroneous index creation SQL is recreated in the next migration, causing the migration to fail, or creating another index which emits a MySQL warning (`_mysql_exceptions.Warning: Duplicate index 'cdn_image_cdn_path_2654d3de68657258_uniq' defined on the table 'xxx.cdn_image'. This is deprecated and will be disallowed in a future release.`), thus causing the migration to fail. Here's the model: {{{ class Image(models.Model): """Model for the saved images""" comment = models.ManyToManyField( 'base.Comment', null=None, default=1, verbose_name=_('Found in comment')) orig_src = models.URLField( verbose_name=_('Original source'), max_length=512, db_index=True) mime_type = models.CharField(verbose_name=_('Mime type'), max_length=100) cdn_path = models.CharField( verbose_name=_('Path in CDN'), max_length=255, unique=True) file_hash = models.CharField( verbose_name=_('File hash'), max_length=200, unique=True) def __str__(self): return self.cdn_path }}} -- Ticket URL: <https://code.djangoproject.com/ticket/24410> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.70a0731a2a769a6793575e06e7bea61e%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.