summaryrefslogtreecommitdiff
path: root/db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 15:10:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 15:10:41 +0000
commitef73ee020e96f39a109a16c4c6b018d8ea7cabc1 (patch)
tree97972e4a7522ba99152b4f75d03062aed48e7c1a /db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb
parent4e8387dc14ea8fb054c413ea237cf9e2e04cee83 (diff)
downloadgitlab-ce-ef73ee020e96f39a109a16c4c6b018d8ea7cabc1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb')
-rw-r--r--db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb b/db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb
new file mode 100644
index 00000000000..5e907092e83
--- /dev/null
+++ b/db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class CleanupTransferedProjectsSharedRunners < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 25_000
+ INTERVAL = 3.minutes
+ MIGRATION = 'ResetSharedRunnersForTransferredProjects'
+
+ disable_ddl_transaction!
+
+ class Namespace < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'namespaces'
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(Namespace,
+ MIGRATION,
+ INTERVAL,
+ batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # This migration fixes an inconsistent database state resulting from https://gitlab.com/gitlab-org/gitlab/-/issues/271728
+ # and as such does not require a down migration
+ end
+end