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

extra_foreign_keys.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: 887e86c7bfd9f8bca5a03b92e8f8abf5690b28fa (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 Database
    module SchemaValidation
      module Validators
        class ExtraForeignKeys < BaseValidator
          ERROR_MESSAGE = "The foreign key %s is present in the database, but not in the structure.sql file"

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

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