oncall-engine/engine/apps
Joey Orlando a29e35c25a
refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292)
# What this PR does

Related to https://github.com/grafana/oncall-private/issues/2947

**NOTE**

This PR introduces steps 1 and 2 of the 3 part migration proposed
[here](https://raintank-corp.slack.com/archives/C06K1MQ07GS/p1732555465144099).
Step 3, swapping reads to be from the new-column and dropping
dual-writes, will be done in a future PR/release.

---

I’m tackling this work now because _ultimately_ I want to move
`AlertReceiveChannel.rate_limited_in_slack_at` to
`SlackChannel.rate_limited_at` , but first I sorta need to refactor
`SlackMessage.channel_id` from a `CHAR` field to a foreign key
relationship (because in the spots where we touch Slack rate limiting,
like
[here](https://github.com/grafana/oncall/blob/dev/engine/apps/slack/alert_group_slack_service.py#L42-L50)
for example, we only have `slack_message.channel_id`, which means I need
to do extra queries to fetch the appropriate `SlackChannel` to then be
able to get/set `SlackChannel.rate_limited_at`

Other minor stuffs:
- it also prepares us to drop `SlackMessage._slack_team_identity`. We
already have a `@property` of `SlackMessage.slack_team_identity` (which
[previously had some hacky
logic](https://github.com/grafana/oncall/blob/dev/engine/apps/slack/models/slack_message.py#L74-L84)).
I've refactored `SlackMessage.slack_team_identity` to simply point to
`self.organization.slack_team_identity` + updated our code to _stop_
setting `SlackMessage._slack_team_identity` (will drop this column in
future release)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-11-26 11:03:38 +00:00
..
alerts refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292) 2024-11-26 11:03:38 +00:00
api Enable service account token auth for public API (#5254) 2024-11-19 12:52:23 +00:00
api_for_grafana_incident Allow valid URLs for web image_url template (#5150) 2024-10-10 13:21:36 +00:00
auth_token Enable service account token auth for public API (#5254) 2024-11-19 12:52:23 +00:00
base Reschedule rate limited telegram task instead of retry (#5178) 2024-10-15 13:35:54 +00:00
chatops_proxy update URLs constructed by the backend to support IRM plugin (#5137) 2024-10-09 08:55:10 -04:00
email Inbound email improvements (continued) (#5294) 2024-11-25 09:32:53 +00:00
exotel Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
google feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
grafana_plugin Enable service account token auth for public API (#5254) 2024-11-19 12:52:23 +00:00
heartbeat chore: remove deprecated slack_channel and heartbeat integration types (#5270) 2024-11-20 11:17:04 -05:00
integrations chore: remove deprecated slack_channel and heartbeat integration types (#5270) 2024-11-20 11:17:04 -05:00
labels fix: update internal labels endpoints to work with RBAC (#5099) 2024-10-02 17:39:49 +00:00
metrics_exporter Split up organizations across metrics exporters (#5127) 2024-10-08 17:29:36 +00:00
mobile_app remove add_stack_slug_to_message_title utility from push notification titles (#5258) 2024-11-15 10:29:00 +00:00
oss_installation feat: update RBAC permissioning to support grafana-irm-app (#5149) 2024-10-10 19:02:21 +00:00
phone_notifications Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
public_api refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292) 2024-11-26 11:03:38 +00:00
schedules refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292) 2024-11-26 11:03:38 +00:00
slack refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292) 2024-11-26 11:03:38 +00:00
social_auth SocialAuthAuthCanceledExceptionMiddleware should only process social … (#5221) 2024-11-04 04:54:47 +00:00
telegram Fix acknowledge reminder task (#5179) 2024-10-16 12:13:28 +00:00
twilioapp Listen for alert group actions during whole notification call (#5282) 2024-11-22 04:34:40 +00:00
user_management refactor SlackMessage.channel_id (CHAR field) to SlackMessage.channel (foreign key relationship) (#5292) 2024-11-26 11:03:38 +00:00
webhooks Add manual trigger support for webhooks (#4934) 2024-09-09 12:17:23 +00:00
zvonok Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00