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

base.rb « schema_objects « schema_validation « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43d30dc54ae69352044f7a6d413149ba79d63c88 (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
# frozen_string_literal: true

module Gitlab
  module Database
    module SchemaValidation
      module SchemaObjects
        class Base
          def initialize(parsed_stmt)
            @parsed_stmt = parsed_stmt
          end

          def name
            raise NoMethodError, "subclasses of #{self.class.name} must implement #{__method__}"
          end

          def table_name
            parsed_stmt.relation.relname
          end

          def statement
            @statement ||= PgQuery.deparse_stmt(parsed_stmt)
          end

          private

          attr_reader :parsed_stmt
        end
      end
    end
  end
end