summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/reindexing/queued_action.rb
blob: c2039a289da8da5c7edd0fa265d218c5f5a7fb67 (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 Reindexing
      class QueuedAction < SharedModel
        self.table_name = 'postgres_reindex_queued_actions'

        enum state: { queued: 0, done: 1, failed: 2 }

        belongs_to :index, foreign_key: :index_identifier, class_name: 'Gitlab::Database::PostgresIndex'

        scope :in_queue_order, -> { queued.order(:created_at) }

        def to_s
          "queued action [ id = #{id}, index: #{index_identifier} ]"
        end
      end
    end
  end
end