2018-11-30 16:03:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-06 22:46:14 +00:00
|
|
|
class BackfillHashedProjectRepositories < ActiveRecord::Migration[4.2]
|
2018-11-30 16:03:29 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
BATCH_SIZE = 1_000
|
2018-12-06 22:46:14 +00:00
|
|
|
DELAY_INTERVAL = 5.minutes
|
2018-11-30 16:03:29 +00:00
|
|
|
MIGRATION = 'BackfillHashedProjectRepositories'
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
class Project < ActiveRecord::Base
|
|
|
|
include EachBatch
|
|
|
|
|
|
|
|
self.table_name = 'projects'
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
|
|
|
queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, DELAY_INTERVAL)
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2018-12-06 22:46:14 +00:00
|
|
|
# no-op: since there could have been existing rows before the migration do not remove anything
|
2018-11-30 16:03:29 +00:00
|
|
|
end
|
|
|
|
end
|