With a mysql-5.5 server using charset utf8mb4 (supports 4 byte utf8
characters), doing this

mysql --default-character-set=utf8mb4 -uroot -ppassword db_name

mysql> CREATE TABLE `schema_migrations` (`filename` varchar(255) PRIMARY
KEY);

fails because mysql with myisam has a 1000 byte limit on index fields,
and innodb has a 767 byte limit on index fields.

mysql> SET storage_engine=innodb;
mysql> CREATE TABLE `schema_migrations` (`filename` varchar(255) PRIMARY
KEY);
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

mysql> SET storage_engine=MYISAM;
mysql> CREATE TABLE `schema_migrations` (`filename` varchar(255) PRIMARY
KEY);
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes

The type_literal_generic_string method assumes (reasonably, IMHO) that a
String field with no length specified should have a length of 255. And
the schema_dataset method for datestamp migrations does not provide a
limit when it creates the schema_migrations table.

I've worked around this for my case. But it will impact anyone using
migrations to create a String field with no length specified, with mysql
and utf8mb4.

I'm happy to provide a patch, but I'm not sure of the best place to
figure out the maximum length for String fields. The adapter maybe?

Or maybe just limit the schema_migrations.filename field to 191 characters?

regards
John

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to