I had this in my models.py
category = models.CharField(max_length=1024, null=False)
I changed it to this:
category = models.CharField(max_length=256, null=False)
and migrated successfully.
and then I changed it to this:
category = models.CharField(max_length=256, null=False, db_index=True)
While migrating I get this:
_mysql_exceptions.Warning: Specified key was too long; max key length is 767 bytes
and migration breaks.
However when I open phpmyadmin panel I see that the index has been created.
Should I care? Should I do anything not to have this warning? Is this warning important?
EDIT: field collation is utf8_general_ci
According MySQL 5.6 doc: Limits on InnoDB Tables
By default, an index key for a single-column index can be up to 767 bytes. The same length limit applies to any index key prefix.
When you attempt to specify an index prefix length longer than allowed, the length is silently reduced to the maximum length for a nonunique index.
For a unique index, exceeding the index prefix limit produces an error. To avoid such errors for replication configurations, avoid setting the innodb_large_prefix option on the master if it cannot also be set on the slaves, and the slaves have unique indexes that could be affected by this limit.