Script to generate elastic migration files
What does this MR do and why?
Adds a script in scripts/
to generate Elastic migration files and introduces a migration dictionary.
The following files are created:
- Elastic migration file
ee/elastic/migrate/#{timestamp}_#{file_name}.rb
- Migration spec file
ee/spec/elastic/migrate/#{timestamp}_#{file_name}_spec.rb
- Migration dictionary file
ee/elastic/docs/#{timestamp}_#{file_name}.yml
Contents of dictionary file:
---
name: CreateEpicIndex
version: '20230704110410'
description: Creates an index for storing and searching epics
group: group::global_search
milestone: '16.2'
introduced_by_url:
obsolete: false
marked_obsolete_by_url:
marked_obsolete_in_milestone:
Where name
, description
and group
as read as generator inputs and timestamp
and milestone
are based on the current time. The obsolete fields can be used to help support and admins doing upgrades to track when a migration was marked obsolete vs. when it was introduced.
Follow-up MR(s) will backfill dictionary records for all existing migrations.
Contents of migration file:
# frozen_string_literal: true
class CreateEpicIndex < Elastic::Migration
end
Contents of spec file:
# frozen_string_literal: true
require 'spec_helper'
require_relative 'migration_shared_examples'
require File.expand_path('ee/elastic/migrate/20230704110410_create_epic_index.rb')
RSpec.describe CreateEpicIndex, feature_category: :global_search do
let(:version) { 20230704110410 }
end
How to set up and validate locally
- Run
scripts/elastic-migration
and follow the prompts.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #414674 (closed)
Edited by Madelein van Niekerk