diff options
Diffstat (limited to 'db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb')
-rw-r--r-- | db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb b/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb new file mode 100644 index 00000000000..25d23b771d5 --- /dev/null +++ b/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb @@ -0,0 +1,30 @@ +# 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 |