﻿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
16460	Add support for Index Length for MySQL-backed Models	umbrae@…	nobody	"On occasion, it is useful to be able to specific a key length different than the field length for a field - this is particularly true with MySQL, whose index sizes are limited to 767 bytes in InnoDB.

For example, I have a simple field like the following:

{{{
url = models.CharField(max_length=767, db_index=True)
}}}

Where all fields are UTF-8 characters, and hence 3 bytes each. This will issue a warning when I try to syncdb (and will full-on fail in south, as south bombs out on warnings):

_mysql_exceptions.Warning: Specified key was too long; max key length is 767 bytes

What I'd like to be able to do is the following:

{{{
url = models.CharField(max_length=767, db_index=True, index_length=255)
}}}

Which will then change the CREATE INDEX sql to look like:

{{{
CREATE INDEX ""some_table_a4b49ab"" ON ""some_table"" (""url""(255));
}}}

This should no longer issue a warning in MySQL.
"	New feature	closed	Database layer (models, ORM)	dev	Normal	invalid		umbrae@…	Design decision needed	0	0	0	0	0	0
