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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/gitlab/background_migrations.rake')
-rw-r--r--lib/tasks/gitlab/background_migrations.rake23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/background_migrations.rake b/lib/tasks/gitlab/background_migrations.rake
new file mode 100644
index 00000000000..c978a2807ca
--- /dev/null
+++ b/lib/tasks/gitlab/background_migrations.rake
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+namespace :gitlab do
+ namespace :background_migrations do
+ task :finalize, [:job_class_name, :table_name, :column_name, :job_arguments] => :environment do |_, args|
+ [:job_class_name, :table_name, :column_name, :job_arguments].each do |argument|
+ unless args[argument]
+ puts "Must specify #{argument} as an argument".color(:red)
+ exit 1
+ end
+ end
+
+ Gitlab::Database::BackgroundMigration::BatchedMigrationRunner.finalize(
+ args[:job_class_name],
+ args[:table_name],
+ args[:column_name],
+ Gitlab::Json.parse(args[:job_arguments])
+ )
+
+ puts "Done.".color(:green)
+ end
+ end
+end