diff options
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb b/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb new file mode 100644 index 00000000000..b989d9fb43d --- /dev/null +++ b/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class BackfillHashedProjectRepositories < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 1.minutes + 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 + # Since there could have been existing rows before the migration + # do not remove anything + end +end |