Skip to content

Commit

Permalink
chore: remove SlackMessage._channel_id and `SlackMessage.organizati…
Browse files Browse the repository at this point in the history
…on` fields (#5340)

# What this PR does

Follow-up cleanup PR for #5325
(and #5330)

## 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.
  • Loading branch information
joeyorlando authored Dec 6, 2024
1 parent e115617 commit dd23931
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 23 deletions.
22 changes: 22 additions & 0 deletions engine/apps/slack/0013_remove_slackmessage__channel_id_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# NOTE: this is being left in this directory on purpose, it will be moved to apps/alerts/migrations
# in a separate PR/release
#
# Generated by Django 4.2.17 on 2024-12-06 17:05

from django.db import migrations

import common.migrations.remove_field


class Migration(migrations.Migration):
dependencies = [
("slack", "0012_remove_slackmessage_organization_state"),
]

operations = [
common.migrations.remove_field.RemoveFieldDB(
model_name="SlackMessage",
name="_channel_id",
remove_state_migration=("slack", "0011_remove_slackmessage__channel_id_state"),
),
]
22 changes: 22 additions & 0 deletions engine/apps/slack/0014_remove_slackmessage_organization_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# NOTE: this is being left in this directory on purpose, it will be moved to apps/alerts/migrations
# in a separate PR/release
#
# Generated by Django 4.2.17 on 2024-12-06 17:05

from django.db import migrations

import common.migrations.remove_field


class Migration(migrations.Migration):
dependencies = [
("slack", "0013_remove_slackmessage__channel_id_db"),
]

operations = [
common.migrations.remove_field.RemoveFieldDB(
model_name="SlackMessage",
name="organization",
remove_state_migration=("slack", "0012_remove_slackmessage_organization_state"),
),
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# NOTE: this is being left in this directory on purpose, it will be moved to apps/alerts/migrations
# in a separate PR/release
#
# Generated by Django 4.2.16 on 2024-12-04 12:00

from django.db import migrations
Expand All @@ -10,7 +7,7 @@

class Migration(migrations.Migration):
dependencies = [
("slack", "0008_remove_slackmessage_active_update_task_id_state"),
("slack", "0009_drop_orphaned_messages_and_fill_in_missing_team_identity_values"),
]

operations = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.17 on 2024-12-06 17:05

import common.migrations.remove_field
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('slack', '0010_remove_slackmessage_active_update_task_id_db'),
]

operations = [
common.migrations.remove_field.RemoveFieldState(
model_name='SlackMessage',
name='_channel_id',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.17 on 2024-12-06 17:05

import common.migrations.remove_field
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('slack', '0011_remove_slackmessage__channel_id_state'),
]

operations = [
common.migrations.remove_field.RemoveFieldState(
model_name='SlackMessage',
name='organization',
),
]
19 changes: 0 additions & 19 deletions engine/apps/slack/models/slack_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ class SlackMessage(models.Model):
id = models.CharField(primary_key=True, default=uuid.uuid4, editable=False, max_length=36)
slack_id = models.CharField(max_length=100)

_channel_id = models.CharField(max_length=100, null=True, default=None)
"""
DEPRECATED/TODO: this is no longer being referenced/set, drop in a separate PR/release
"""

channel = models.ForeignKey(
"slack.SlackChannel", on_delete=models.CASCADE, null=True, default=None, related_name="slack_messages"
)
Expand All @@ -52,20 +47,6 @@ class SlackMessage(models.Model):
(a slack message always needs to have a slack channel associated with it)
"""

organization = models.ForeignKey(
"user_management.Organization",
on_delete=models.CASCADE,
null=True,
default=None,
related_name="slack_message",
)
"""
DEPRECATED/TODO: drop this field in a separate PR/release
For alert group related slack messages, we can always get the organization from the alert_group.channel
For shift swap request related slack messages, the schedule has a reference to the organization
"""

_slack_team_identity = models.ForeignKey(
"slack.SlackTeamIdentity",
on_delete=models.PROTECT,
Expand Down

0 comments on commit dd23931

Please sign in to comment.