Migration to add correct_work_item_type_id to work items index
Background
With [Cells 1.0] Default Work Item Types: Ensure wor... (&15272 - closed) we need to make sure values from work_item_types.id are sequential values 1 - 9. This affects the issues table, as we currently have a foreign key issues.work_item_type_id that relies on these values.
The work items index indexes the work_item_type_id field and will need to adjust to accommodate ensuring work item type IDs are constant sequential 1-9 values.
Proposal
- Add a new field to the work items index named
correct_work_item_type_id. Use theElastic::MigrationUpdateMappingsHelper - Add field to mappings in
Search::Elastic::Types::WorkItem - Populate the field in
Search::Elastic::References::WorkItemusingElastic::DataMigrationService.migration_has_finished?to only populate it if the migration above is done - Update specs as needed
Edited by Terri Chu