-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schema: Order incident_history_event_type
Ordering the incident_history_event_type enum allows sorting incident_history events by time and type while expecting a logical correct order. This may be necessary because millisecond resolution results in identical timestamps for subsequent entries. Closes #61.
- Loading branch information
Showing
4 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ALTER TYPE incident_history_event_type RENAME TO __incident_history_event_type; | ||
CREATE TYPE incident_history_event_type AS ENUM ( | ||
-- Order to be honored for events with identical microsecond timestamps. | ||
'opened', | ||
'incident_severity_changed', | ||
'rule_matched', | ||
'escalation_triggered', | ||
'recipient_role_changed', | ||
'closed', | ||
'notified' | ||
); | ||
ALTER TABLE incident_history ALTER type TYPE incident_history_event_type USING type::TEXT::incident_history_event_type; | ||
DROP TYPE __incident_history_event_type; | ||
|
||
CREATE INDEX idx_incident_history_time_type ON incident_history(time, type); | ||
COMMENT ON INDEX idx_incident_history_time_type IS 'Incident History ordered by time/type'; |