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

20200422091541_create_ci_instance_variables.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab2a4722f893e64722baf6f01cd90a1cfda8e3cc (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
# frozen_string_literal: true

class CreateCiInstanceVariables < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers
  DOWNTIME = false

  disable_ddl_transaction!

  def up
    unless table_exists?(:ci_instance_variables)
      create_table :ci_instance_variables do |t|
        t.integer :variable_type, null: false, limit: 2, default: 1
        t.boolean :masked, default: false, allow_null: false
        t.boolean :protected, default: false, allow_null: false
        t.text :key, null: false
        t.text :encrypted_value
        t.text :encrypted_value_iv

        t.index [:key], name: 'index_ci_instance_variables_on_key', unique: true, using: :btree
      end
    end

    add_text_limit(:ci_instance_variables, :key, 255)
    add_text_limit(:ci_instance_variables, :encrypted_value, 1024)
    add_text_limit(:ci_instance_variables, :encrypted_value_iv, 255)
  end

  def down
    drop_table :ci_instance_variables
  end
end