зеркало из https://github.com/mozilla/treeherder.git
Implement DB migrations for allowing changing of the culprit feature (#8295)
This commit is contained in:
Родитель
146ec53e25
Коммит
b2231d1b39
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 5.1.3 on 2024-11-14 13:30
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def update_summary_original_push(apps, schema_editor):
|
||||
PerformanceAlertSummary = apps.get_model('perf', 'PerformanceAlertSummary')
|
||||
for alert in PerformanceAlertSummary.objects.all():
|
||||
alert.original_push = alert.push
|
||||
alert.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("perf", "0055_remove_performancealerttesting_related_summary_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="performancealertsummary",
|
||||
name="original_push",
|
||||
field=models.ForeignKey(
|
||||
default=None,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="+",
|
||||
to="model.push",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(update_summary_original_push, reverse_code=migrations.RunPython.noop),
|
||||
]
|
|
@ -272,7 +272,9 @@ class PerformanceAlertSummary(models.Model):
|
|||
|
||||
prev_push = models.ForeignKey(Push, on_delete=models.CASCADE, related_name="+")
|
||||
push = models.ForeignKey(Push, on_delete=models.CASCADE, related_name="+")
|
||||
|
||||
original_push = models.ForeignKey(
|
||||
Push, on_delete=models.CASCADE, related_name="+", null=True, default=None
|
||||
)
|
||||
manually_created = models.BooleanField(default=False)
|
||||
|
||||
notes = models.TextField(null=True, blank=True)
|
||||
|
@ -344,6 +346,9 @@ class PerformanceAlertSummary(models.Model):
|
|||
if update_fields is not None:
|
||||
update_fields = {"bug_due_date"}.union(update_fields)
|
||||
|
||||
if not self.original_push:
|
||||
self.original_push = self.push
|
||||
|
||||
super().save(*args, update_fields=update_fields, **kwargs)
|
||||
self.__prev_bug_number = self.bug_number
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче