debian-mirror-gitlab/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb
2021-06-08 01:23:25 +05:30

31 lines
665 B
Ruby

# frozen_string_literal: true
class ScheduleMigrateProjectTaggingsContextFromTagsToTopics < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
BATCH_SIZE = 30_000
DELAY_INTERVAL = 2.minutes
MIGRATION = 'MigrateProjectTaggingsContextFromTagsToTopics'
disable_ddl_transaction!
class Tagging < ActiveRecord::Base
include ::EachBatch
self.table_name = 'taggings'
end
def up
queue_background_migration_jobs_by_range_at_intervals(
Tagging.where(taggable_type: 'Project', context: 'tags'),
MIGRATION,
DELAY_INTERVAL,
batch_size: BATCH_SIZE
)
end
def down
end
end