-
Notifications
You must be signed in to change notification settings - Fork 21
Description
When using MySQL as a session backend the SQL generated for creating the table looks like:
CREATe TABLE `persistent_session`( PRIMARY KEY (`key`),`key` TEXT CHARACTER SET utf8 NOT NULL,`auth_id` BLOB NULL,`session` BLOB NOT NULL,`created_at` DATETIME NOT NULL,`accessed_at` DATETIME NOT NULL)
however when that is ran it gets a error:
*** Exception: ConnectionError {errFunction = "query", errNumber = 1170, errMessage = "BLOB/TEXT column 'key' used in key specification without a key length"}
Error 1170 says:
MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length. The error happens because MySQL can index only the first N chars of a BLOB or TEXT column.
So to have a text value as a key you would need it to be bound in some way. When researching most people said to instead use a varchar(###) to get similar results as text, but with the proper limiting for the index. I have manually created a table using varchar(255) as an experiment and it works fine. Though now if i run the migrations it crashes as it tries to alter the table back to an unbounded text column.
I've attempted to look at the code to see how to fix it, but I'm not experienced with persistent's inner working and have no idea what the best course of action would be to use MySQL as a session backend.
Thanks