Skip to content

Create database tables for escalation policies and rules

Sean Arnold requested to merge 323138-database-escalation-policies-models into master

What does this MR do?

This adds two tables needed for the Escalation Policies epic.

Model: IncidentManagement::EscalationPolicy

Column Required Type
id true Integer
project_id true Integer
name true text
description false text

Validations/constraints:

  • project, name should be present
  • name length should be under 72 chars
  • description length should be under 160 chars
  • Must have at least one EscalationRule
  • Unique constraint: name should be unique within the project.

Table: incident_management_escalation_rules

Model: IncidentManagement::EscalationRule

Column Required Type Description
id true Integer
policy_id true Integer IncidentManagement::EscalationPolicy to which the escalation rule belongs
status true Integer One of AlertManagement::Alert::STATUSES values for either :acknowlegded or :resolved
elapsed_time true Integer Time in minutes from the creation of an alert at which this rule should be enacted
schedule_id true Integer IncidentManagement::OncallSchedule which should be notified in escalation rule

Validations/constraints:

  • project, status, elapsed_time, schedule should all be present
  • schedule_id should belong to the project of escalation policy
  • status should be one of AlertManagement::Alert::STATUSES values for either :acknowlegded or :resolved (one of [1, 2])
  • elapsed_time should be an integer >= 0 & <= 24.hours
  • Unique constraint: Combo of policy_id, status, elapsed_time, schedule_id should be unique. This is all the attributes. Is there a simple way to do this? Should we allow duplicate rules?

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #323138 (closed)

Edited by Sean Arnold

Merge request reports