Add tables/models for IssuableEscalationStatus & IssuableEscalations

Motivation

These tables and models represent the data structures required to escalate manually created incidents according to escalation policies. The primary goal of this issue is to unblock the next pieces of work so that they can be taken in parallel.

These tables will be used with the logic built in #330281 (closed).

Scope

  • Add 2 new tables.
  • Add 2 new models & validations.
  • Add relevant associations to existing models.

Implementation Plan

This approach assumes we can't add new fields to issues directly, as has been the case with severities & SLAs.

Table: incident_management_issuable_escalation_statuses

Model: IncidentManagement::IssuableEscalationStatus

Column Required Type 
 Description
id true Integer ID of the object
issue_id true Integer Incident which has an escalation status
status true Integer One of AlertManagement::Alert::STATUSES

Validations/constraints:

  • issue, status should both be present
  • status should be in AlertManagement::Alert::STATUSES
  • Unique constraint: issue_id should be unique

Table: incident_management_issuable_escalations

Model: IncidentManagement::IssuableEscalations

Column Required Type 
 Description
id true Integer ID of the escalation
policy_id true Integer Escalation Policy to which the escalation corresponds
issue_id true Integer ID of the escalate-able IssuableEscalationStatus
created_at true datetime_with_zone Creation time of the escalation (AKA - time at which the escalation was "triggered")
updated_at true datetime_with_zone Update time of the escalation (AKA - time at which notifications were last sent out)

Validations/constraints:

  • issue, policy should both be present
  • Unique constraint: issue_id should be unique
  • Test/confirm that adding IssuableEscalation does not break the Protect stage's implementation for Alerts. Additional context. Docs.
Edited by Thiago Figueiró