gitlab-org--gitlab-foss/db/post_migrate/20201030203854_backfill_design_iids.rb

27 lines
569 B
Ruby

# frozen_string_literal: true
class BackfillDesignIids < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
class Designs < ActiveRecord::Base
include EachBatch
self.table_name = 'design_management_designs'
end
def up
backfill = ::Gitlab::BackgroundMigration::BackfillDesignInternalIds.new(Designs)
Designs.select(:project_id).distinct.each_batch(of: 100, column: :project_id) do |relation|
backfill.perform(relation)
end
end
def down
# NOOP
end
end