Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200923102312_update_programming_language_colors.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 37233bd31483a34344e70f6245f0b60053e21a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true
require 'yaml'

class UpdateProgrammingLanguageColors < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  class ProgrammingLanguage < ActiveRecord::Base; end

  def up
    YAML.load_file("vendor/languages.yml").each do |name, metadata|
      color = metadata["color"]
      next unless color.present?

      ProgrammingLanguage.where(name: name).update(color: color)
    end
  end

  def down
    # noop
  end
end