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

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

module Gitlab
  module Database
    class PostgresAutovacuumActivity < SharedModel
      self.table_name = 'postgres_autovacuum_activity'
      self.primary_key = 'table_identifier'

      def self.for_tables(tables)
        Gitlab::Database::LoadBalancing::Session.current.use_primary do
          where('schema = current_schema()').where(table: tables)
        end
      end

      def to_s
        "table #{table_identifier} (started: #{vacuum_start})"
      end
    end
  end
end