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

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

class AddEscalationPolicies < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  UNIQUE_INDEX_NAME = 'index_on_project_id_escalation_policy_name_unique'

  def up
    create_table_with_constraints :incident_management_escalation_policies do |t|
      t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade }
      t.text :name, null: false
      t.text :description, null: true

      t.text_limit :name, 72
      t.text_limit :description, 160
      t.index [:project_id, :name], unique: true, name: UNIQUE_INDEX_NAME
    end
  end

  def down
    drop_table :incident_management_escalation_policies
  end
end