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 'db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb')
-rw-r--r--db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb b/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb
new file mode 100644
index 00000000000..cbd0d0ea3a2
--- /dev/null
+++ b/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ScheduleDeleteOrphanedDeployments < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'DeleteOrphanedDeployments'
+ BATCH_SIZE = 100_000
+ DELAY_INTERVAL = 2.minutes
+
+ disable_ddl_transaction!
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ define_batchable_model('deployments'),
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ track_jobs: true
+ )
+ end
+
+ def down
+ # no-op
+ end
+end