diff options
Diffstat (limited to 'db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb')
-rw-r--r-- | db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb b/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb new file mode 100644 index 00000000000..e9ab45ae9a1 --- /dev/null +++ b/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class BackfillStoreProjectFullPathInRepo < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 5.minutes + UP_MIGRATION = 'BackfillProjectFullpathInRepoConfig::Up' + DOWN_MIGRATION = 'BackfillProjectFullpathInRepoConfig::Down' + + disable_ddl_transaction! + + class Project < ActiveRecord::Base + self.table_name = 'projects' + + include EachBatch + end + + def up + queue_background_migration_jobs_by_range_at_intervals(Project, UP_MIGRATION, DELAY_INTERVAL) + end + + def down + queue_background_migration_jobs_by_range_at_intervals(Project, DOWN_MIGRATION, DELAY_INTERVAL) + end +end |