Skip to content

Make MySQL patch for binary indexes compatible with composite indexes

Olivier Gonzalez requested to merge fix_mysql_binary_index_patch into master

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?

Edited by Yorick Peterse

Merge request reports