debian-mirror-gitlab/db/migrate/20190711124721_create_job_variables.rb

28 lines
956 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class CreateJobVariables < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
2020-05-24 23:13:21 +05:30
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
2019-10-12 21:52:04 +05:30
def change
create_table :ci_job_variables do |t|
t.string :key, null: false
t.text :encrypted_value
t.string :encrypted_value_iv
t.references :job, null: false, index: true, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
t.integer :variable_type, null: false, limit: 2, default: 1
end
add_index :ci_job_variables, [:key, :job_id], unique: true
end
2020-05-24 23:13:21 +05:30
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
2019-10-12 21:52:04 +05:30
end