Forums de discussion

Safe to change the unique key length of the Lock_ table?

thumbnail
Thomas Berg, modifié il y a 10 années.

Safe to change the unique key length of the Lock_ table?

Regular Member Publications: 131 Date d'inscription: 07/09/09 Publications récentes
Hi,

I'm in the process of upgrading Liferay to 6.2.0 and at the same time, fix an old mistake by changing character set and collation to utf-8 for all tables.
My problem is that the Lock_ table has this field:

`owner` varchar(300) DEFAULT NULL


When restoring the sql-dump, MySQL has the following complaint:

ERROR 1071 (42000) at line 3763: Specified key was too long; max key length is 767 bytes
.

The "offending" key is this:

UNIQUE KEY `IX_DD635956` (`className`,`key_`,`owner`),


As MySQL with InnoDB has a limit of 767 bytes for keys, a solution would be to change the length of the field to 255.

My question is, would it be safe to make the following change?

`owner` varchar(300) DEFAULT NULL --> `owner` varchar(255) DEFAULT NULL


Also, it would be interesting to know where this (300) came from since the create-mysql.sql-files that I've looked at (6.0.5, 6.1.1) seem to have other (smaller) values for the owner field!?

Regards Thomas