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

missing_foreign_keys.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: daebd4582825b79002009d632d4a0dcb0ecb0cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  module Schema
    module Validation
      module Validators
        class MissingForeignKeys < Base
          ERROR_MESSAGE = "The foreign key %s is missing from the database"

          def execute
            structure_sql.foreign_keys.filter_map do |structure_sql_fk|
              next if database.foreign_key_exists?(structure_sql_fk.name)

              build_inconsistency(self.class, structure_sql_fk, nil)
            end
          end
        end
      end
    end
  end
end