debian-mirror-gitlab/lib/gitlab/database/background_migration/batched_job_transition_log.rb
2022-04-04 11:22:00 +05:30

27 lines
941 B
Ruby

# frozen_string_literal: true
module Gitlab
module Database
module BackgroundMigration
class BatchedJobTransitionLog < ApplicationRecord
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