From e15d18a6049f4b50ffcac30c604f8d7677ca5a2b Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Wed, 26 Jul 2023 14:48:06 +0200 Subject: [PATCH] drop alert_receive_channel.restricted_at column (#2646) # What this PR does Drop `alert_receive_channel.restricted_at` column ## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Vadim Stepanov --- ..._drop_alertreceivechannel_restricted_at.py | 19 +++++++++++++++++++ .../alerts/models/alert_receive_channel.py | 6 ------ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 engine/apps/alerts/migrations/0028_drop_alertreceivechannel_restricted_at.py diff --git a/engine/apps/alerts/migrations/0028_drop_alertreceivechannel_restricted_at.py b/engine/apps/alerts/migrations/0028_drop_alertreceivechannel_restricted_at.py new file mode 100644 index 00000000..3fe8f97c --- /dev/null +++ b/engine/apps/alerts/migrations/0028_drop_alertreceivechannel_restricted_at.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.20 on 2023-07-26 06:41 + +from django.db import migrations +import django_migration_linter as linter + + +class Migration(migrations.Migration): + + dependencies = [ + ("alerts", "0027_remove_alertreceivechannel_restricted_at_from_state"), + ] + + operations = [ + linter.IgnoreMigration(), + migrations.RunSQL( + sql="ALTER TABLE alerts_alertreceivechannel DROP COLUMN restricted_at", + reverse_sql="ALTER TABLE alerts_alertreceivechannel ADD COLUMN restricted_at datetime(6) NULL" + ) + ] diff --git a/engine/apps/alerts/models/alert_receive_channel.py b/engine/apps/alerts/models/alert_receive_channel.py index 1ee7ba84..5041a873 100644 --- a/engine/apps/alerts/models/alert_receive_channel.py +++ b/engine/apps/alerts/models/alert_receive_channel.py @@ -198,12 +198,6 @@ class AlertReceiveChannel(IntegrationOptionsMixin, MaintainableObject): rate_limited_in_slack_at = models.DateTimeField(null=True, default=None) rate_limit_message_task_id = models.CharField(max_length=100, null=True, default=None) - # TODO: in a subsequent release, write a manual django migration to run the following - # migrations.RunSQL( - # sql = "ALTER TABLE alerts_alertreceivechannel DROP COLUMN restricted_at", - # reverse_sql = migrations.RunSQL.noop - # ) - class Meta: constraints = [ models.UniqueConstraint(