Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wrong_indexes.rb « validators « schema_validation « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a92e7158be754f98af12a1d1e2527e9e0b10b91d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Gitlab
  module Database
    module SchemaValidation
      module Validators
        class WrongIndexes < BaseValidator
          def execute
            structure_sql.indexes.filter_map do |structure_sql_index|
              database_index = database.fetch_index_by_name(structure_sql_index.name)

              next if database_index.nil?
              next if database_index.statement == structure_sql_index.statement

              build_inconsistency(structure_sql_index)
            end
          end
        end
      end
    end
  end
end