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

20230414190012_add_product_analytics_to_project_settings.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c77168f05be9e6184b87fc9f4a9315e3401ee384 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

class AddProductAnalyticsToProjectSettings < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  def up
    with_lock_retries do
      add_column :project_settings, :jitsu_host, :text, if_not_exists: true
      add_column :project_settings, :jitsu_project_xid, :text, if_not_exists: true
      add_column :project_settings, :jitsu_administrator_email, :text, if_not_exists: true
      add_column :project_settings, :encrypted_jitsu_administrator_password, :binary, if_not_exists: true
      add_column :project_settings, :encrypted_jitsu_administrator_password_iv, :binary, if_not_exists: true
      add_column :project_settings, :product_analytics_data_collector_host, :text, if_not_exists: true
      add_column :project_settings, :encrypted_product_analytics_clickhouse_connection_string,
        :binary, if_not_exists: true
      add_column :project_settings, :encrypted_product_analytics_clickhouse_connection_string_iv,
        :binary, if_not_exists: true
      add_column :project_settings, :cube_api_base_url, :text, if_not_exists: true
      add_column :project_settings, :encrypted_cube_api_key, :binary, if_not_exists: true
      add_column :project_settings, :encrypted_cube_api_key_iv, :binary, if_not_exists: true
    end

    add_text_limit :project_settings, :jitsu_host, 255
    add_text_limit :project_settings, :jitsu_project_xid, 255
    add_text_limit :project_settings, :jitsu_administrator_email, 255
    add_text_limit :project_settings, :product_analytics_data_collector_host, 255
    add_text_limit :project_settings, :cube_api_base_url, 512
  end

  def down
    with_lock_retries do
      remove_column :project_settings, :jitsu_host, if_exists: true
      remove_column :project_settings, :jitsu_project_xid, if_exists: true
      remove_column :project_settings, :jitsu_administrator_email, if_exists: true
      remove_column :project_settings, :encrypted_jitsu_administrator_password, if_exists: true
      remove_column :project_settings, :encrypted_jitsu_administrator_password_iv, if_exists: true
      remove_column :project_settings, :product_analytics_data_collector_host, if_exists: true
      remove_column :project_settings, :encrypted_product_analytics_clickhouse_connection_string, if_exists: true
      remove_column :project_settings, :encrypted_product_analytics_clickhouse_connection_string_iv, if_exists: true
      remove_column :project_settings, :cube_api_base_url, if_exists: true
      remove_column :project_settings, :encrypted_cube_api_key, if_exists: true
      remove_column :project_settings, :encrypted_cube_api_key_iv, if_exists: true
    end
  end
end