Reworked https://github.com/grafana/oncall/pull/5047. Main update is the switch from FK to a [M2M relation](https://docs.google.com/document/d/1HeulqxoFShSHtInQrZNJLL5MDlHPNT50rVGaK3zZWvw/edit?disco=AAABVLjV4W8) (which doesn't really change the original/intended behavior, besides not needing to alter the alert group table, and it is a bit more flexible; the extra table shouldn't introduce issues because this is used only for tracking purposes and the information needed in the log record is already there). Avoid a db migration involving alert group table: ``` -- -- Create model RelatedIncident -- CREATE TABLE `alerts_relatedincident` (`id` bigint AUTO_INCREMENT NOT NULL PRIMARY KEY, `incident_id` varchar(50) NOT NULL, `created_at` datetime(6) NOT NULL, `is_active` bool NOT NULL, `channel_filter_id` bigint NULL, `organization_id` bigint NOT NULL); CREATE TABLE `alerts_relatedincident_attached_alert_groups` (`id` bigint AUTO_INCREMENT NOT NULL PRIMARY KEY, `relatedincident_id` bigint NOT NULL, `alertgroup_id` bigint NOT NULL); ALTER TABLE `alerts_relatedincident` ADD CONSTRAINT `alerts_relatedincident_organization_id_incident_id_d7fc9a4f_uniq` UNIQUE (`organization_id`, `incident_id`); ALTER TABLE `alerts_relatedincident` ADD CONSTRAINT `alerts_relatedincide_channel_filter_id_9556c836_fk_alerts_ch` FOREIGN KEY (`channel_filter_id`) REFERENCES `alerts_channelfilter` (`id`); ALTER TABLE `alerts_relatedincident` ADD CONSTRAINT `alerts_relatedincide_organization_id_74ed6bed_fk_user_mana` FOREIGN KEY (`organization_id`) REFERENCES `user_management_organization` (`id`); CREATE INDEX `alerts_relatedincident_incident_id_8356a799` ON `alerts_relatedincident` (`incident_id`); ALTER TABLE `alerts_relatedincident_attached_alert_groups` ADD CONSTRAINT `alerts_relatedincident_a_relatedincident_id_alert_3d683baa_uniq` UNIQUE (`relatedincident_id`, `alertgroup_id`); ALTER TABLE `alerts_relatedincident_attached_alert_groups` ADD CONSTRAINT `alerts_relatedincide_relatedincident_id_3e5e7a23_fk_alerts_re` FOREIGN KEY (`relatedincident_id`) REFERENCES `alerts_relatedincident` (`id`); ALTER TABLE `alerts_relatedincident_attached_alert_groups` ADD CONSTRAINT `alerts_relatedincide_alertgroup_id_0125deca_fk_alerts_al` FOREIGN KEY (`alertgroup_id`) REFERENCES `alerts_alertgroup` (`id`); ```
26 lines
1.7 KiB
Python
26 lines
1.7 KiB
Python
from .acknowledge_reminder import acknowledge_reminder_task # noqa: F401
|
|
from .alert_group_web_title_cache import ( # noqa:F401
|
|
update_web_title_cache,
|
|
update_web_title_cache_for_alert_receive_channel,
|
|
)
|
|
from .check_escalation_finished import check_escalation_finished_task # noqa: F401
|
|
from .custom_webhook_result import custom_webhook_result # noqa: F401
|
|
from .declare_incident import declare_incident # noqa: F401
|
|
from .delete_alert_group import delete_alert_group # noqa: F401
|
|
from .delete_alert_group import finish_delete_alert_group # noqa: F401
|
|
from .delete_alert_group import send_alert_group_signal_for_delete # noqa: F401
|
|
from .escalate_alert_group import escalate_alert_group # noqa: F401
|
|
from .invite_user_to_join_incident import invite_user_to_join_incident # noqa: F401
|
|
from .maintenance import disable_maintenance # noqa: F401
|
|
from .notify_all import notify_all_task # noqa: F401
|
|
from .notify_group import notify_group_task # noqa: F401
|
|
from .notify_ical_schedule_shift import notify_ical_schedule_shift # noqa: F401
|
|
from .notify_user import notify_user_task # noqa: F401
|
|
from .resolve_alert_group_by_source_if_needed import resolve_alert_group_by_source_if_needed # noqa: F401
|
|
from .resolve_by_last_step import resolve_by_last_step_task # noqa: F401
|
|
from .send_alert_group_signal import send_alert_group_signal # noqa: F401
|
|
from .send_update_log_report_signal import send_update_log_report_signal # noqa: F401
|
|
from .send_update_resolution_note_signal import send_update_resolution_note_signal # noqa: F401
|
|
from .sync_grafana_alerting_contact_points import disconnect_integration_from_alerting_contact_points # noqa: F401
|
|
from .unsilence import unsilence_task # noqa: F401
|
|
from .wipe import wipe # noqa: F401
|