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

foreign_key.rb « schema_objects « 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: 41e2d30029ac3ce7c131697205f6b6c027248924 (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
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module Gitlab
  module Schema
    module Validation
      module SchemaObjects
        class ForeignKey
          def initialize(adapter)
            @adapter = adapter
          end

          # Foreign key name should include the schema, as the same name could be used across different schemas
          #
          # @example public.foreign_key_name
          def name
            @name ||= adapter.name
          end

          def table_name
            @table_name ||= adapter.table_name
          end

          def statement
            @statement ||= adapter.statement
          end

          private

          attr_reader :adapter
        end
      end
    end
  end
end