summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/async_constraints/validators/foreign_key.rb
blob: ff6b807c982e538fe855428b2ae5f4a4ddab94ef (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 AsyncConstraints
      module Validators
        class ForeignKey < Base
          private

          override :constraint_exists?
          def constraint_exists?
            Gitlab::Database::PostgresForeignKey
              .by_constrained_table_name_or_identifier(table_name)
              .by_name(name)
              .exists?
          end
        end
      end
    end
  end
end