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

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

module Gitlab
  module Database
    module BackgroundMigration
      class BatchedJobTransitionLog < SharedModel
        include PartitionedTable

        self.table_name = :batched_background_migration_job_transition_logs

        self.primary_key = :id

        partitioned_by :created_at, strategy: :monthly, retain_for: 6.months

        belongs_to :batched_job, foreign_key: :batched_background_migration_job_id

        validates :previous_status, :next_status, :batched_job, presence: true

        validates :exception_class, length: { maximum: 100 }
        validates :exception_message, length: { maximum: 1000 }

        enum previous_status: Gitlab::Database::BackgroundMigration::BatchedJob.state_machine.states.map(&:name), _prefix: true
        enum next_status: Gitlab::Database::BackgroundMigration::BatchedJob.state_machine.states.map(&:name), _prefix: true
      end
    end
  end
end