fix migrations that were causing issues (#2581)

# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
This commit is contained in:
Joey Orlando 2023-07-19 12:20:39 +02:00 committed by GitHub
parent adfb496a81
commit 5eadbbe878
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 23 deletions

View file

@ -1,18 +1,24 @@
# Generated by Django 3.2.20 on 2023-07-18 06:41
from django.db import migrations, models
from django.db import migrations
import django_migration_linter as linter
class Migration(migrations.Migration):
"""
See the comment in the Migration class in engine/apps/alerts/migrations/0004_auto_20220711_1106.py,
we are commenting out this migration for essentially the same reason
"""
dependencies = [
('alerts', '0021_alter_alertgroup_started_at'),
]
operations = [
migrations.AlterField(
model_name='alertgroup',
name='manual_severity',
field=models.IntegerField(choices=[(0, 'high'), (1, 'low'), (2, 'none')], default=2, null=True),
),
linter.IgnoreMigration(),
# migrations.AlterField(
# model_name='alertgroup',
# name='manual_severity',
# field=models.IntegerField(choices=[(0, 'high'), (1, 'low'), (2, 'none')], default=2, null=True),
# ),
]

View file

@ -1,6 +1,7 @@
# Generated by Django 3.2.20 on 2023-07-18 09:52
from django.db import migrations, models
import django_migration_linter as linter
class Migration(migrations.Migration):
@ -10,6 +11,7 @@ class Migration(migrations.Migration):
]
operations = [
linter.IgnoreMigration(),
migrations.AlterModelManagers(
name='alertgroup',
managers=[
@ -19,11 +21,12 @@ class Migration(migrations.Migration):
model_name='alertgroup',
name='alerts_aler_channel_ee84a7_idx',
),
migrations.AlterField(
model_name='alertgroup',
name='is_archived',
field=models.BooleanField(default=False, null=True),
),
# see the comment in 0022_alter_alertgroup_manual_severity as to why we commented this out
# migrations.AlterField(
# model_name='alertgroup',
# name='is_archived',
# field=models.BooleanField(default=False, null=True),
# ),
migrations.AddIndex(
model_name='alertgroup',
index=models.Index(fields=['channel_id', 'resolved', 'acknowledged', 'silenced', 'root_alert_group_id'], name='alerts_aler_channel_81aeec_idx'),

View file

@ -0,0 +1,27 @@
# Generated by Django 3.2.20 on 2023-07-19 10:10
from django.db import migrations
import django_migration_linter as linter
class Migration(migrations.Migration):
dependencies = [
('alerts', '0025_auto_20230718_1042'),
]
operations = [
linter.IgnoreMigration(),
migrations.RemoveField(
model_name='alertgroup',
name='is_archived',
),
migrations.RemoveField(
model_name='alertgroup',
name='manual_severity',
),
migrations.RemoveField(
model_name='alertgroup',
name='resolution_note_ts',
),
]

View file

@ -16,7 +16,6 @@ from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from django.utils.functional import cached_property
from django_deprecate_fields import deprecate_field
from apps.alerts.constants import AlertGroupState
from apps.alerts.escalation_snapshot import EscalationSnapshotMixin
@ -303,16 +302,6 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
)
reason_to_skip_escalation = models.IntegerField(choices=REASONS_TO_SKIP_ESCALATIONS, default=NO_REASON)
SEVERITY_HIGH, SEVERITY_LOW, SEVERITY_NONE = range(3)
SEVERITY_CHOICES = (
(SEVERITY_HIGH, "high"),
(SEVERITY_LOW, "low"),
(SEVERITY_NONE, "none"),
)
manual_severity = deprecate_field(models.IntegerField(choices=SEVERITY_CHOICES, default=SEVERITY_NONE))
resolution_note_ts = deprecate_field(models.CharField(max_length=100, null=True, default=None))
root_alert_group = models.ForeignKey(
"alerts.AlertGroup",
on_delete=models.SET_NULL,
@ -324,7 +313,6 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
# NOTE: we should probably migrate this field to models.UUIDField as it's ONLY ever being
# set to the result of uuid.uuid1
last_unique_unacknowledge_process_id: UUID | None = models.CharField(max_length=100, null=True, default=None)
is_archived = deprecate_field(models.BooleanField(default=False))
wiped_at = models.DateTimeField(null=True, default=None)
wiped_by = models.ForeignKey(