Skip to content

Add schema_version to all document types

Background

We recently introduced a schema_version field to the issue document types (users document type also has it). Adding it to the other document types will help do migrations in the future

Proposal

Add schema_version field to all document types. The format is Date.today.strftime('%y_%m'). The block should match the existing one for issues (including a comment):

        # Schema version. The format is Date.today.strftime('%y_%m')
        # Please update if you're changing the schema of the document
        data['schema_version'] = 22_08

Steps to complete for each document type

  1. Create a new Elastic migration for each index to add the mapping
  2. Add the mapping to each index's _config file: indexes :schema_version, type: :short
  3. Update each index's _instance_proxy file to determine the value of schema_version, guarded by a Elastic::DataMigrationService.migration_has_finished? check

Discussion thread

The following discussion from !96153 (merged) should be addressed:

  • @dgruzd started a discussion: (+1 comment)

    We might want to adopt similar approach for all document types. I think it would greatly simplify the migration process.

Edited by Terri Chu