I think you may be barking up the wrong tree, see https://code.djangoproject.com/ticket/21196
On Friday, October 18, 2013 7:30:10 PM UTC-4, [email protected] wrote: > > Looks like this comes from custom_user.py in django.contrib.auth.tests: > > class CustomUser(AbstractBaseUser): > email = models.EmailField(verbose_name='email address', > max_length=255, unique=True) > is_active = models.BooleanField(default=True) > is_admin = models.BooleanField(default=False) > date_of_birth = models.DateField() > > I think this should have the same length as AbstractUser, where it does > not specify a max_length, so it defaults to 75 in > django.db.models.fields.EmailField. Should I submit a pull request for this > change? > > Thanks! > > On Wednesday, October 16, 2013 11:01:45 AM UTC-7, [email protected]: >> >> Hello! >> >> I tried to run *./manage.py test *for the first time and I got the >> following error: >> >> *DatabaseError: (1071, 'Specified key was too long; max key length is >> 767 bytes')* >> >> Looking at the log in MySQL, it appears to be caused by this statement: >> >> CREATE TABLE `auth_customuser` ( >> `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, >> `password` varchar(128) NOT NULL, >> `last_login` datetime NOT NULL, >> `email` varchar(255) NOT NULL UNIQUE, >> `is_active` bool NOT NULL, >> `is_admin` bool NOT NULL, >> `date_of_birth` date NOT NULL >> ) >> >> >> So the email field of varchar(255) is causing me to go over the >> single-column index of 767 bytes in InnoDB when the charset is utf8mb4, >> that part I understand. >> >> Why is it trying to create this *auth_customuser* table anyways though? >> It doesn't exist in my application normally. The *email* field on my * >> auth_user* table is varchar(75) so no error from that, not sure why it's >> a different length there though. >> >> To get around the issue temporarily I set the database engine to sqlite, >> but I'd like to be able to use MySQL for the tests, since that's what my >> application normally uses. >> >> Thanks in advance! >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1365ded5-dd5b-4259-ae1b-408ce135e212%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

