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

class CleanUpFileStoreCiJobArtifacts < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    # rubocop:disable Migration/UpdateColumnInBatches
    # rubocop:disable Migration/UpdateLargeTable
    update_column_in_batches(:ci_job_artifacts, :file_store, 1) do |table, query|
      query.where(table[:file_store].eq(nil))
    end
    # rubocop:enable Migration/UpdateColumnInBatches
    # rubocop:enable Migration/UpdateLargeTable
  end

  def down
    # no-op
  end
end