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

background_migrations_controller.rb « admin « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c1dffbf423ddf637f7ed800771d4324b5e601082 (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

class Admin::BackgroundMigrationsController < Admin::ApplicationController
  feature_category :database

  def index
    @relations_by_tab = {
      'queued' => batched_migration_class.queued.queue_order,
      'failed' => batched_migration_class.failed.queue_order,
      'finished' => batched_migration_class.finished.queue_order.reverse_order
    }

    @current_tab = @relations_by_tab.key?(params[:tab]) ? params[:tab] : 'queued'
    @migrations = @relations_by_tab[@current_tab].page(params[:page])
    @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id))
  end

  private

  def batched_migration_class
    Gitlab::Database::BackgroundMigration::BatchedMigration
  end
end