Create Batched Background Migration to update Kotlin color
The Kotlin color has been updated in Change color for Kotlin language (!135991 - merged), however, it was discovered that this change was not showing the new color on gitlab.com.
From some investigation it looks like we only fetch the color values from the YAML file if we do not have a record in the database already. To fix the issue we need to create a migration to update the color values for Kotlin to #7F52FF
https://docs.gitlab.com/ee/development/database/batched_background_migrations.html
I'm looking through the code to figure out how this logic works. So far I have found
We render the language bar here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/show.html.haml#L20
Which calls our helper from here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/helpers/repository_languages_helper.rb
The helper calls
language.color
: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/helpers/repository_languages_helper.rb#L15Which has been passed in during rendering so now looking for
project.repository_languages
Interestingly that's a relation: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/project.rb#L331
The RepositoryLanguage model: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/repository_language.rb
Delegates color to ProgrammingLanguage model: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/programming_language.rb
So looks like these values are actually stored in the database.
I can see a call to create ProgrammingLanguage records if they don't exist here https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/projects/detect_repository_languages_service.rb#L53