Skip to content

Add `incident_management_timeline_events` table and `TimelineEvent` model

What does this MR do and why?

Add incident_management_timeline_events table and TimelineEvent model

Implements to #344056 (closed)

Overall epic with description of the feature at &6376 (closed)

Differences between current implementation and requirements from the issue

Database

`db:migrate`
→ be rails db:migrate
== 20211115132613 CreateIncidentManagementTimelineEvents: migrating ===========
-- create_table(:incident_management_timeline_events, {})
-- quote_column_name(:note)
   -> 0.0000s
-- quote_column_name(:note_html)
   -> 0.0000s
-- quote_column_name(:action)
   -> 0.0000s
   -> 0.0311s
== 20211115132613 CreateIncidentManagementTimelineEvents: migrated (0.0312s) ==

== 20211115142803 AddForeignKeyToIncidentManagementTimelineEventsOnProject: migrating -- transaction_open?() -> 0.0000s -- foreign_keys(:incident_management_timeline_events) -> 0.0040s -- transaction_open?() -> 0.0000s -- execute("ALTER TABLE incident_management_timeline_events\nADD CONSTRAINT fk_4432fc4d78\nFOREIGN KEY (project_id)\nREFERENCES projects (id)\nON DELETE CASCADE\nNOT VALID;\n") -> 0.0051s -- execute("SET statement_timeout TO 0") -> 0.0006s -- execute("ALTER TABLE incident_management_timeline_events VALIDATE CONSTRAINT fk_4432fc4d78;") -> 0.0080s -- execute("RESET statement_timeout") -> 0.0006s == 20211115142803 AddForeignKeyToIncidentManagementTimelineEventsOnProject: migrated (0.0306s)

== 20211115142847 AddForeignKeyToIncidentManagementTimelineEventsOnUser: migrating -- transaction_open?() -> 0.0000s -- foreign_keys(:incident_management_timeline_events) -> 0.0024s -- transaction_open?() -> 0.0000s -- execute("ALTER TABLE incident_management_timeline_events\nADD CONSTRAINT fk_1800597ef9\nFOREIGN KEY (author_id)\nREFERENCES users (id)\nON DELETE CASCADE\nNOT VALID;\n") -> 0.0030s -- execute("ALTER TABLE incident_management_timeline_events VALIDATE CONSTRAINT fk_1800597ef9;") -> 0.0047s == 20211115142847 AddForeignKeyToIncidentManagementTimelineEventsOnUser: migrated (0.0144s)

== 20211115142911 AddForeignKeyToIncidentManagementTimelineEventsOnIssue: migrating -- transaction_open?() -> 0.0000s -- foreign_keys(:incident_management_timeline_events) -> 0.0028s -- transaction_open?() -> 0.0000s -- execute("ALTER TABLE incident_management_timeline_events\nADD CONSTRAINT fk_17a5fafbd4\nFOREIGN KEY (issue_id)\nREFERENCES issues (id)\nON DELETE CASCADE\nNOT VALID;\n") -> 0.0024s -- execute("ALTER TABLE incident_management_timeline_events VALIDATE CONSTRAINT fk_17a5fafbd4;") -> 0.0216s == 20211115142911 AddForeignKeyToIncidentManagementTimelineEventsOnIssue: migrated (0.0310s)

== 20211116093739 AddForeignKeyToIncidentManagementTimelineEventsOnUpdatedByUser: migrating -- transaction_open?() -> 0.0000s -- foreign_keys(:incident_management_timeline_events) -> 0.0023s -- transaction_open?() -> 0.0000s -- execute("ALTER TABLE incident_management_timeline_events\nADD CONSTRAINT fk_38a74279df\nFOREIGN KEY (updated_by_user_id)\nREFERENCES users (id)\nON DELETE SET NULL\nNOT VALID;\n") -> 0.0012s -- execute("ALTER TABLE incident_management_timeline_events VALIDATE CONSTRAINT fk_38a74279df;") -> 0.0016s == 20211116093739 AddForeignKeyToIncidentManagementTimelineEventsOnUpdatedByUser: migrated (0.0094s)

== 20211130151724 AddForeignKeyToIncidentManagementTimelineEventsOnNote: migrating -- transaction_open?() -> 0.0000s -- foreign_keys(:incident_management_timeline_events) -> 0.0025s -- transaction_open?() -> 0.0000s -- execute("ALTER TABLE incident_management_timeline_events\nADD CONSTRAINT fk_d606a2a890\nFOREIGN KEY (promoted_from_note_id)\nREFERENCES notes (id)\nON DELETE SET NULL\nNOT VALID;\n") -> 0.0021s -- execute("ALTER TABLE incident_management_timeline_events VALIDATE CONSTRAINT fk_d606a2a890;") -> 0.0079s == 20211130151724 AddForeignKeyToIncidentManagementTimelineEventsOnNote: migrated (0.0166s)

`db:rollback STEP=5`
→ be rails db:rollback
== 20211130151724 AddForeignKeyToIncidentManagementTimelineEventsOnNote: reverting
-- transaction_open?()
   -> 0.0000s
-- remove_foreign_key(:incident_management_timeline_events, {:column=>:promoted_from_note_id})
   -> 0.0056s
== 20211130151724 AddForeignKeyToIncidentManagementTimelineEventsOnNote: reverted (0.0173s)

== 20211116093739 AddForeignKeyToIncidentManagementTimelineEventsOnUpdatedByUser: reverting -- transaction_open?() -> 0.0000s -- remove_foreign_key(:incident_management_timeline_events, {:column=>:updated_by_user_id}) -> 0.0034s == 20211116093739 AddForeignKeyToIncidentManagementTimelineEventsOnUpdatedByUser: reverted (0.0070s)

== 20211115142911 AddForeignKeyToIncidentManagementTimelineEventsOnIssue: reverting -- transaction_open?() -> 0.0000s -- remove_foreign_key(:incident_management_timeline_events, {:column=>:issue_id}) -> 0.0031s == 20211115142911 AddForeignKeyToIncidentManagementTimelineEventsOnIssue: reverted (0.0064s)

== 20211115142847 AddForeignKeyToIncidentManagementTimelineEventsOnUser: reverting -- transaction_open?() -> 0.0000s -- remove_foreign_key(:incident_management_timeline_events, {:column=>:author_id}) -> 0.0036s == 20211115142847 AddForeignKeyToIncidentManagementTimelineEventsOnUser: reverted (0.0070s)

== 20211115142803 AddForeignKeyToIncidentManagementTimelineEventsOnProject: reverting -- transaction_open?() -> 0.0000s -- remove_foreign_key(:incident_management_timeline_events, {:column=>:project_id}) -> 0.0033s == 20211115142803 AddForeignKeyToIncidentManagementTimelineEventsOnProject: reverted (0.0066s)

== 20211115132613 CreateIncidentManagementTimelineEvents: reverting =========== -- drop_table(:incident_management_timeline_events) -> 0.0028s == 20211115132613 CreateIncidentManagementTimelineEvents: reverted (0.0028s) ==

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vitali Tatarintev

Merge request reports

Loading