﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21308	DatabaseError running tests with MySQL & utf8mb4 charset	Greg Barker <fletch@…>	nobody	"Character set and collation set to utf8mb4:
{{{
$ cat /etc/mysql/my.cnf | grep utf8
character-set-server = utf8mb4
collation-server     = utf8mb4_general_ci
}}}

Create a new site
{{{
$ virtualenv test-env
$ cd test-env
$ source ./bin/activate
(temp-test) $ pip install django
(temp-test) $ pip install mysql-python
(temp-test) $ django-admin.py startproject mysite
}}}

Update settings.py to use MySQL and create your database

Then run the tests, hit the error
{{{
$ python mysite/manage.py test
Creating test database for alias 'default'...
DatabaseError: (1071, 'Specified key was too long; max key length is 767 bytes')
}}}

MySQL query log reveals it fails on 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
)
}}}

Which originates 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 it should be like the User class, which does not specify the max_length, so it defaults the value to 75."	Bug	closed	contrib.auth	1.5	Normal	duplicate			Unreviewed	0	0	0	0	0	0
