summaryrefslogtreecommitdiff
path: root/db/post_migrate/20191122135327_remove_plaintext_columns_from_application_settings.rb
blob: b5cd58b10a86d73eb80fc6fdf9559786b2742b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

class RemovePlaintextColumnsFromApplicationSettings < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  PLAINTEXT_ATTRIBUTES = %w[
    akismet_api_key
    elasticsearch_aws_secret_access_key
    recaptcha_private_key
    recaptcha_site_key
    slack_app_secret
    slack_app_verification_token
  ].freeze

  def up
    PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute|
      remove_column :application_settings, plaintext_attribute
    end
  end

  def down
    PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute|
      add_column :application_settings, plaintext_attribute, :text
    end
  end
end