diff --git a/ee/elastic/docs/20230719094243_add_archived_to_commits.yml b/ee/elastic/docs/20230719094243_add_archived_to_commits.yml new file mode 100644 index 0000000000000000000000000000000000000000..b2f40c0c91f20324cbbcc459a8f266201907bb36 --- /dev/null +++ b/ee/elastic/docs/20230719094243_add_archived_to_commits.yml @@ -0,0 +1,11 @@ +--- +name: AddArchivedToCommits +version: '20230719094243' +description: Add archived column in commit index +group: group::global search +milestone: 16.3 +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127004 +obsolete: false +marked_obsolete_by_url: +marked_obsolete_in_milestone: + diff --git a/ee/elastic/migrate/20230719094243_add_archived_to_commits.rb b/ee/elastic/migrate/20230719094243_add_archived_to_commits.rb new file mode 100644 index 0000000000000000000000000000000000000000..7e1bfdad941c4f3a751ec54b43b255a05e513679 --- /dev/null +++ b/ee/elastic/migrate/20230719094243_add_archived_to_commits.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddArchivedToCommits < Elastic::Migration + include Elastic::MigrationUpdateMappingsHelper + + private + + def index_name + ::Elastic::Latest::CommitConfig.index_name + end + + def new_mappings + { + archived: { + type: 'boolean' + } + } + end +end diff --git a/ee/lib/elastic/latest/commit_config.rb b/ee/lib/elastic/latest/commit_config.rb index a2314f15b5b85c25d3d428d64c440a8ec12f41ff..8eb2773e51ef9aedb86562efe428a2ac26fdeb9e 100644 --- a/ee/lib/elastic/latest/commit_config.rb +++ b/ee/lib/elastic/latest/commit_config.rb @@ -43,6 +43,7 @@ module CommitConfig indexes :repository_access_level, type: :integer indexes :hashed_root_namespace_id, type: :integer indexes :schema_version, type: :integer + indexes :archived, type: :boolean end end end diff --git a/ee/spec/elastic/migrate/20230719094243_add_archived_to_commits_spec.rb b/ee/spec/elastic/migrate/20230719094243_add_archived_to_commits_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..8aa8bbd70e89da5cd84b41a1e5158a20cb11ea0e --- /dev/null +++ b/ee/spec/elastic/migrate/20230719094243_add_archived_to_commits_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_relative 'migration_shared_examples' +require File.expand_path('ee/elastic/migrate/20230719094243_add_archived_to_commits.rb') + +RSpec.describe AddArchivedToCommits, :elastic, :sidekiq_inline, feature_category: :global_search do + let(:version) { 20230719094243 } + + include_examples 'migration adds mapping' +end