dbal
dbal copied to clipboard
Allow partial index length on MySQL Primary Keys
Feature Request
Q | A |
---|---|
New Feature | yes |
RFC | no |
BC Break | no |
Summary
DBAL does support specification of a length for column indexes when using MySQL databases. A common usage of this is when a varchar column longer than 191 character needs to have an index defined - depending on the mysql server version in use and its configuration parameters this might be allowed or not. When not allowed, a possible workaround is to define the index on a portion (prefix) of the whole column. At the moment DBAL support for this is limited to the definition of extra indexes (including Unique indexes), but it excludes the definition of a Primary Key. Given the fact that defining a PK with an index length is supported by MySQL, and that the same apparent violation of logical constraints applies to unique indexes as well, I think that it makes sense to add DBAL support to PKs with a specified length.