Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
commitcd52759ee33051b8ad7b88b02ba7954e4fad7018 (patch)
treef1096c68e457aef7f5201acd16e4a751ff538026 /lib/gitlab/background_migration
parent18f7828977b74bf6e5153594a098ef90e773b3b7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r--lib/gitlab/background_migration/update_authorized_keys_file_since.rb13
-rw-r--r--lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb2
-rw-r--r--lib/gitlab/background_migration/user_mentions/models/merge_request.rb45
-rw-r--r--lib/gitlab/background_migration/user_mentions/models/merge_request_user_mention.rb18
4 files changed, 64 insertions, 14 deletions
diff --git a/lib/gitlab/background_migration/update_authorized_keys_file_since.rb b/lib/gitlab/background_migration/update_authorized_keys_file_since.rb
deleted file mode 100644
index dd80d4bab1a..00000000000
--- a/lib/gitlab/background_migration/update_authorized_keys_file_since.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- # rubocop: disable Style/Documentation
- class UpdateAuthorizedKeysFileSince
- def perform(cutoff_datetime)
- end
- end
- end
-end
-
-Gitlab::BackgroundMigration::UpdateAuthorizedKeysFileSince.prepend_if_ee('EE::Gitlab::BackgroundMigration::UpdateAuthorizedKeysFileSince')
diff --git a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb
index 22b984887b1..cf0f582a2d4 100644
--- a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb
+++ b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb
@@ -8,7 +8,7 @@ module Gitlab
# Resources that have mentions to be migrated:
# issue, merge_request, epic, commit, snippet, design
- BULK_INSERT_SIZE = 5000
+ BULK_INSERT_SIZE = 1_000
ISOLATION_MODULE = 'Gitlab::BackgroundMigration::UserMentions::Models'
def perform(resource_model, join, conditions, with_notes, start_id, end_id)
diff --git a/lib/gitlab/background_migration/user_mentions/models/merge_request.rb b/lib/gitlab/background_migration/user_mentions/models/merge_request.rb
new file mode 100644
index 00000000000..655c1db71ae
--- /dev/null
+++ b/lib/gitlab/background_migration/user_mentions/models/merge_request.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+# rubocop:disable Style/Documentation
+
+module Gitlab
+ module BackgroundMigration
+ module UserMentions
+ module Models
+ class MergeRequest < ActiveRecord::Base
+ include Concerns::IsolatedMentionable
+ include CacheMarkdownField
+ include Concerns::MentionableMigrationMethods
+
+ attr_mentionable :title, pipeline: :single_line
+ attr_mentionable :description
+ cache_markdown_field :title, pipeline: :single_line
+ cache_markdown_field :description, issuable_state_filter_enabled: true
+
+ self.table_name = 'merge_requests'
+
+ belongs_to :author, class_name: "User"
+ belongs_to :target_project, class_name: "Project"
+ belongs_to :source_project, class_name: "Project"
+
+ alias_attribute :project, :target_project
+
+ def self.user_mention_model
+ Gitlab::BackgroundMigration::UserMentions::Models::MergeRequestUserMention
+ end
+
+ def user_mention_model
+ self.class.user_mention_model
+ end
+
+ def user_mention_resource_id
+ id
+ end
+
+ def user_mention_note_id
+ 'NULL'
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/background_migration/user_mentions/models/merge_request_user_mention.rb b/lib/gitlab/background_migration/user_mentions/models/merge_request_user_mention.rb
new file mode 100644
index 00000000000..e9b85e9cb8c
--- /dev/null
+++ b/lib/gitlab/background_migration/user_mentions/models/merge_request_user_mention.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+# rubocop:disable Style/Documentation
+
+module Gitlab
+ module BackgroundMigration
+ module UserMentions
+ module Models
+ class MergeRequestUserMention < ActiveRecord::Base
+ self.table_name = 'merge_request_user_mentions'
+
+ def self.resource_foreign_key
+ :merge_request_id
+ end
+ end
+ end
+ end
+ end
+end