summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210525075724_clean_up_pending_builds_table.rb')
-rw-r--r--db/post_migrate/20210525075724_clean_up_pending_builds_table.rb28
1 files changed, 0 insertions, 28 deletions
diff --git a/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb b/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb
deleted file mode 100644
index 59b41dd2008..00000000000
--- a/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class CleanUpPendingBuildsTable < ActiveRecord::Migration[6.0]
- include ::Gitlab::Database::DynamicModelHelpers
-
- BATCH_SIZE = 1000
-
- disable_ddl_transaction!
-
- def up
- return unless Gitlab.dev_or_test_env? || Gitlab.com?
-
- each_batch_range('ci_pending_builds', connection: connection, of: BATCH_SIZE) do |min, max|
- execute <<~SQL
- DELETE FROM ci_pending_builds
- USING ci_builds
- WHERE ci_builds.id = ci_pending_builds.build_id
- AND ci_builds.status != 'pending'
- AND ci_builds.type = 'Ci::Build'
- AND ci_pending_builds.id BETWEEN #{min} AND #{max}
- SQL
- end
- end
-
- def down
- # noop
- end
-end