grafana / oncall

Developer-friendly incident response with brilliant Slack integration
GNU Affero General Public License v3.0
3.48k stars 285 forks source link

feat: convert `organization.general_log_channel_id` to `organization.default_slack_channel` #5191

Open joeyorlando opened 4 days ago

joeyorlando commented 4 days ago

What this PR does

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

Right now general_log_channel_id is just a string value representing the Slack Channel ID (ex. C043HQ70QMB). This PR migrates this instead to be a foreign key relationship on the slack_slackchannel table and updates all references to general_log_channel_id.

Tested migrations locally:

Operations to perform:
  Apply all migrations: [redacted secret grafana-admin-creds:admin-user], alerts, auth, auth_token, base, contenttypes, email, exotel, fcm_django, google, heartbeat, labels, mobile_app, oss_installation, phone_notifications, schedules, sessions, slack, social_django, telegram, twilioapp, user_management, webhooks, zvonok
Running migrations:
  Applying user_management.0024_organization_general_log_slack_channel... OK
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0025_auto_20241017_1919 Starting migration to populate general_log_slack_channel field.
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0025_auto_20241017_1919 Total organizations to process: 1
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0025_auto_20241017_1919 Organization 1 updated with SlackChannel 2 (slack_id: C043LL6RTS7).
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0025_auto_20241017_1919 Finished migration. Total organizations processed: 1. Organizations updated: 1. Missing SlackChannels: 0.
  Applying user_management.0025_auto_20241017_1919... OK

Future incoming PRs

Checklist