[5.7] Support index length on MySQL#25200
[5.7] Support index length on MySQL#25200staudenmeir wants to merge 1 commit intolaravel:5.7from staudenmeir:index-length
Conversation
I think SQLite supports it via expression indexes, but I havn't looked into it.
I disagree with this part. |
This is one of the major pain points with the current migrations and the Fluent approach: unsupported stuff totally goes unnnoticed until you realize later it didn't work. Great example from practice: you switch from MySQL to Postgres. You may say "edge case", I say unnecessary pain point because of "laziness" (note: this isn't meant a diss of your work 👍 , just how it might turn out in the end). |
|
No plans to add this at this time. |
|
@staudenmeir @sisve @mfn we're reconsidering this for Laravel 7. Would any of you be up to create a PR for the master branch? I think support for other DB engines is wanted as well. |
This PR allows MySQL migrations to specify the index length:
This is especially useful for
TEXTcolumns, as they don't allow indexes without a length.PostgreSQL, SQLite and SQL Server don't support index lengths. There is a workaround for PostgreSQL, but it only supports non-unique indexes and is cumbersome to use in queries. So I don't think it's worth the effort.
I didn't add exceptions for the other databases because I don't think they are necessary for a such a minor feature.
Resolves #9293.