Skip to content

Extract more db/docs logic to ::Gitlab::Database::Dictionary

Dylan Griffith requested to merge extract-db-dictionary-entries into master

What does this MR do and why?

Recently we added the Gitlab::Database::Dictionary class. Initially it only had the responsibilit of wrapping the content of a single db/docs/*.yml file. But this MR moves all the logic in this clas down to Gitlab::Database::Dictionary::Entry and adds a class methods Dictionary.entries and Dictionary.entry to load a single entry. The changes to this file will be most easily reviewed ignoring whitespace because a lot of it has just been indented under Entry.

This refactoring moved the previous logic for building an array of entries from the GitlabSchema class because that was not a suitable place for generic handling of db/docs/*.yml files.

This will help with !136682 (merged) to allow us to reuse the dictionary building logic in validating the sharding_key.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dylan Griffith

Merge request reports

Loading