summaryrefslogtreecommitdiff
path: root/db/migrate/20200116051619_drop_background_migration_jobs.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 18:09:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 18:09:00 +0000
commitc57e10faab0abb213e7a18274fd5a98ba87a5c09 (patch)
treede0195e28dfe19fbfeb5bffa8fde4f511288d8ef /db/migrate/20200116051619_drop_background_migration_jobs.rb
parent11e5d1b9ca3efa7be34ddebb708a6aedb4e91639 (diff)
downloadgitlab-ce-c57e10faab0abb213e7a18274fd5a98ba87a5c09.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20200116051619_drop_background_migration_jobs.rb')
-rw-r--r--db/migrate/20200116051619_drop_background_migration_jobs.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20200116051619_drop_background_migration_jobs.rb b/db/migrate/20200116051619_drop_background_migration_jobs.rb
new file mode 100644
index 00000000000..f492ec0af9d
--- /dev/null
+++ b/db/migrate/20200116051619_drop_background_migration_jobs.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DropBackgroundMigrationJobs < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications'
+ QUEUE = 'background_migration'
+
+ def up
+ Sidekiq::Queue.new(QUEUE).each do |job|
+ klass, project_id, *should_be_empty = job.args
+ next unless klass == DROPPED_JOB_CLASS && project_id.is_a?(Integer) && should_be_empty.empty?
+
+ job.delete
+ end
+ end
+end