summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220222192525_remove_null_releases.rb
blob: 4efd5393122edc18ecf33b78329a233ff2115740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class RemoveNullReleases < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  class Release < ActiveRecord::Base
    include EachBatch

    self.table_name = 'releases'
  end

  def up
    Release.all.each_batch(of: 25000) do |rel|
      rel.where(tag: nil).delete_all
    end
  end

  def down
    # no-op
    #
    # releases with the same tag within a project have been removed
    # and therefore the duplicate release data is no longer available
  end
end