debian-mirror-gitlab/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb

31 lines
710 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
class EnqueueFixCrossProjectLabelLinks < ActiveRecord::Migration[4.2]
2018-11-08 19:23:39 +05:30
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
BATCH_SIZE = 100
MIGRATION = 'FixCrossProjectLabelLinks'
DELAY_INTERVAL = 5.minutes
disable_ddl_transaction!
class Label < ActiveRecord::Base
self.table_name = 'labels'
end
class Namespace < ActiveRecord::Base
self.table_name = 'namespaces'
include ::EachBatch
default_scope { where(type: 'Group', id: Label.where(type: 'GroupLabel').select('distinct group_id')) }
end
def up
queue_background_migration_jobs_by_range_at_intervals(Namespace, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
end
def down
# noop
end
end