summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-03-16 16:44:13 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-03-16 16:44:13 +0200
commitfbf2ea70bfc8a2d5c59fb9d74c17ca6f34f7672b (patch)
tree2d6b9539a40431ade974c26e4a422f36c96952e4
parent4a81867df14801c302f72096de8ee5327cfb4a39 (diff)
downloadgitlab-ce-dz-improve-rename-projects-migration.tar.gz
Improve rename projects migrationdz-improve-rename-projects-migration
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--changelogs/unreleased/dz-improve-rename-projects-migration.yml4
-rw-r--r--db/post_migrate/20170313133418_rename_more_reserved_project_names.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/changelogs/unreleased/dz-improve-rename-projects-migration.yml b/changelogs/unreleased/dz-improve-rename-projects-migration.yml
new file mode 100644
index 00000000000..10f3def1c74
--- /dev/null
+++ b/changelogs/unreleased/dz-improve-rename-projects-migration.yml
@@ -0,0 +1,4 @@
+---
+title: Improve multi-threading for rename_more_reserved_project_names.rb migration
+merge_request: 10009
+author:
diff --git a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
index 9dfe77bedb7..d9a3ae802ea 100644
--- a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
+++ b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
@@ -10,6 +10,12 @@ class RenameMoreReservedProjectNames < ActiveRecord::Migration
KNOWN_PATHS = %w(artifacts graphs refs badges).freeze
+ class Project < ::Project
+ def self.connection
+ Thread.current[:thread_local_connection] || ActiveRecord::Base.connection
+ end
+ end
+
def up
queues = Array.new(THREAD_COUNT) { Queue.new }
start = false