summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/background_migration/batched_job.rb
blob: 3b624df2bfdd0d37ea2fed28d60fa8f18083df56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module Database
    module BackgroundMigration
      class BatchedJob < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
        self.table_name = :batched_background_migration_jobs

        belongs_to :batched_migration, foreign_key: :batched_background_migration_id

        enum status: {
          pending: 0,
          running: 1,
          failed: 2,
          succeeded: 3
        }

        delegate :aborted?, :job_class, :table_name, :column_name, :job_arguments,
          to: :batched_migration, prefix: :migration
      end
    end
  end
end