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/api/admin/batched_background_migrations.rb')
-rw-r--r--lib/api/admin/batched_background_migrations.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/api/admin/batched_background_migrations.rb b/lib/api/admin/batched_background_migrations.rb
index 675f3365bd3..e8cc08a23be 100644
--- a/lib/api/admin/batched_background_migrations.rb
+++ b/lib/api/admin/batched_background_migrations.rb
@@ -61,6 +61,11 @@ module API
end
put do
Gitlab::Database::SharedModel.using_connection(base_model.connection) do
+ unless batched_background_migration.paused?
+ msg = 'You can resume only `paused` batched background migrations.'
+ render_api_error!(msg, 422)
+ end
+
batched_background_migration.execute!
present_entity(batched_background_migration)
end
@@ -81,6 +86,11 @@ module API
end
put do
Gitlab::Database::SharedModel.using_connection(base_model.connection) do
+ unless batched_background_migration.active?
+ msg = 'You can pause only `active` batched background migrations.'
+ render_api_error!(msg, 422)
+ end
+
batched_background_migration.pause!
present_entity(batched_background_migration)
end