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

pg_depend.rb « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f3cdaeb979810e2bea655afe06c902df0158386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module Database
    class PgDepend < SharedModel
      self.table_name = 'pg_depend'

      TYPES = {
        'VIEW' => %w[v m].freeze
      }.freeze

      scope :from_pg_extension, ->(type = nil) do
        joins('INNER JOIN pg_class ON pg_class.oid = pg_depend.objid')
          .where(pg_class: { relkind: TYPES.fetch(type.to_s) })
          .where("refclassid = 'pg_extension'::pg_catalog.regclass")
      end
    end
  end
end