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

20210729202143_create_incident_management_issuable_escalation_statuses.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b16904a3b472f1bbc6dfdd43fe8f625b83d928e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class CreateIncidentManagementIssuableEscalationStatuses < ActiveRecord::Migration[6.1]
  ISSUE_IDX = 'index_uniq_im_issuable_escalation_statuses_on_issue_id'
  POLICY_IDX = 'index_im_issuable_escalation_statuses_on_policy_id'

  def change
    create_table :incident_management_issuable_escalation_statuses do |t|
      t.timestamps_with_timezone

      t.references :issue, foreign_key: { on_delete: :cascade }, index: { unique: true, name: ISSUE_IDX }, null: false
      t.references :policy, foreign_key: { to_table: :incident_management_escalation_policies, on_delete: :nullify }, index: { name: POLICY_IDX }

      t.datetime_with_timezone :escalations_started_at
      t.datetime_with_timezone :resolved_at

      t.integer :status, default: 0, null: false, limit: 2
    end
  end
end