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

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

module Gitlab
  module Schema
    module Validation
      module Validators
        class DifferentDefinitionIndexes < Base
          ERROR_MESSAGE = 'The %s index has a different statement between structure.sql and database'

          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(self.class, structure_sql_index, database_index)
            end
          end
        end
      end
    end
  end
end