diff options
Diffstat (limited to 'app/controllers/admin/background_migrations_controller.rb')
-rw-r--r-- | app/controllers/admin/background_migrations_controller.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/admin/background_migrations_controller.rb b/app/controllers/admin/background_migrations_controller.rb new file mode 100644 index 00000000000..c1dffbf423d --- /dev/null +++ b/app/controllers/admin/background_migrations_controller.rb @@ -0,0 +1,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 |