Make MySQL patch for binary indexes compatible with composite indexes
What does this MR do?
Fix the MySQL patch for binary indexes to make it compatible with composite indexes.
When using composite index we need to use a hash for the :length
index option, otherwise it will apply the same length for all keys of the composite index, which is not what we want.
e.g. a unique index based on a fingerprint
sha and a project_id
integer should be specified as:
t.index [:fingerprint, :project_id], unique: true, length: { fingerprint: 20 }
With existing patch, the mysql create index
statement will apply a length of 20
even for the integer column, which will throw an error.
This MR allows to set the length option only for binary columns, falling back to default value for other column types.
What are the relevant issue numbers?
This is necessary for https://gitlab.com/gitlab-org/gitlab-ee/issues/7046
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides
Edited by Yorick Peterse