Commit 0cc7d124 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Replace mysql index limit logic with helper method for ee migrations

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2422ae01
......@@ -11,7 +11,7 @@ class AddPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Mi
add_concurrent_index(:project_repository_states,
[:repository_verification_checksum, :wiki_verification_checksum],
name: INDEX_NAME,
length: Gitlab::Database.mysql? ? 20 : nil,
length: mysql_compatible_index_length,
where: 'repository_verification_checksum IS NULL OR wiki_verification_checksum IS NULL'
)
end
......
......@@ -9,11 +9,11 @@ class AddPartialIndexToProjectRepositoryStatesVerificationColumns < ActiveRecord
def up
unless index_exists?(:project_repository_states, :last_repository_verification_failure, name: REPOSITORY_INDEX_NAME)
add_concurrent_index(:project_repository_states, :last_repository_verification_failure, name: REPOSITORY_INDEX_NAME, length: Gitlab::Database.mysql? ? 20 : nil, where: 'last_repository_verification_failure IS NOT NULL')
add_concurrent_index(:project_repository_states, :last_repository_verification_failure, name: REPOSITORY_INDEX_NAME, length: mysql_compatible_index_length, where: 'last_repository_verification_failure IS NOT NULL')
end
unless index_exists?(:project_repository_states, :last_wiki_verification_failure, name: WIKI_INDEX_NAME)
add_concurrent_index(:project_repository_states, :last_wiki_verification_failure, name: WIKI_INDEX_NAME, length: Gitlab::Database.mysql? ? 20 : nil, where: 'last_wiki_verification_failure IS NOT NULL')
add_concurrent_index(:project_repository_states, :last_wiki_verification_failure, name: WIKI_INDEX_NAME, length: mysql_compatible_index_length, where: 'last_wiki_verification_failure IS NOT NULL')
end
end
......
......@@ -23,7 +23,7 @@ class FixPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Mi
add_concurrent_index(:project_repository_states,
[:repository_verification_checksum, :wiki_verification_checksum],
name: OLD_INDEX_NAME,
length: Gitlab::Database.mysql? ? 20 : nil,
length: mysql_compatible_index_length,
where: 'repository_verification_checksum IS NULL OR wiki_verification_checksum IS NULL'
)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment