add is_restricted column to alert_group table (#2289)
# What this PR does Plus mark `alert_receive_channel.restricted_at` column as deprecated. This column will be removed in a future release. ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated (N/A) - [ ] Documentation added (or `pr:no public docs` PR label added if not required) (N/A) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) (N/A)
This commit is contained in:
parent
75682517f1
commit
4f2d3bee9f
4 changed files with 21 additions and 6 deletions
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.19 on 2023-06-19 12:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('alerts', '0016_auto_20230523_1355'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='alertgroup',
|
||||
name='is_restricted',
|
||||
field=models.BooleanField(default=False, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -365,12 +365,7 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
|
|||
# https://code.djangoproject.com/ticket/28545
|
||||
is_open_for_grouping = models.BooleanField(default=None, null=True, blank=True)
|
||||
|
||||
@property
|
||||
def is_restricted(self):
|
||||
integration_restricted_at = self.channel.restricted_at
|
||||
if integration_restricted_at is None:
|
||||
return False
|
||||
return self.started_at >= integration_restricted_at
|
||||
is_restricted = models.BooleanField(default=False, null=True)
|
||||
|
||||
@staticmethod
|
||||
def get_silenced_state_filter():
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ 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: remove this field after AlertGroup.is_restricted change has been released
|
||||
restricted_at = models.DateTimeField(null=True, default=None)
|
||||
|
||||
class Meta:
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class OrganizationManager(models.Manager):
|
|||
|
||||
|
||||
class Organization(MaintainableObject):
|
||||
|
||||
objects = OrganizationManager()
|
||||
objects_with_deleted = models.Manager()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue