summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-07 23:16:44 +0000
committerStan Hu <stanhu@gmail.com>2018-12-07 23:16:44 +0000
commit9655a602ac0d186e10c44f7b6bcdfc0f14ac7b6a (patch)
treee61c2ada5b2ad79e5607bb241df5a376c3238a84 /db
parenta27ba8edfa6f41de135cf6f1573cc5366440f7b5 (diff)
parent8c9e692095afb59111c73781c8ee501cb4cb2459 (diff)
downloadgitlab-ce-9655a602ac0d186e10c44f7b6bcdfc0f14ac7b6a.tar.gz
Merge branch 'tc-backfill-hashed-project_repositories' into 'master'
Fill project_repositories for hashed storage projects Closes #48527 See merge request gitlab-org/gitlab-ce!23482
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb26
1 files changed, 26 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..7814cdba58a
--- /dev/null
+++ b/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class BackfillHashedProjectRepositories < ActiveRecord::Migration[4.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ DELAY_INTERVAL = 5.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
+ # no-op: since there could have been existing rows before the migration do not remove anything
+ end
+end