diff --git a/api/tacticalrmm/checks/migrations/0027_auto_20220401_2248.py b/api/tacticalrmm/checks/migrations/0027_auto_20220401_2248.py index cc556bf6..368fb36d 100644 --- a/api/tacticalrmm/checks/migrations/0027_auto_20220401_2248.py +++ b/api/tacticalrmm/checks/migrations/0027_auto_20220401_2248.py @@ -26,12 +26,16 @@ def migrate_check_results(apps, schema_editor): retcode=check.retcode, execution_time=check.execution_time, history=check.history, + alert_severity=check.alert_severity + if check.check_type + in ["cpuload", "memory", "diskspace", "script"] + else None, ) else: CheckResult.objects.create( - assigned_check=check, - agent=check.agent, + assigned_check_id=check.id, + agent_id=check.agent.id, status=check.status, more_info=check.more_info, last_run=check.last_run, @@ -43,6 +47,10 @@ def migrate_check_results(apps, schema_editor): retcode=check.retcode, execution_time=check.execution_time, history=check.history, + alert_severity=check.alert_severity + if check.check_type + in ["cpuload", "memory", "diskspace", "script"] + else None, ) except IntegrityError: pass diff --git a/api/tacticalrmm/checks/migrations/0029_alter_checkresult_alert_severity.py b/api/tacticalrmm/checks/migrations/0029_alter_checkresult_alert_severity.py new file mode 100644 index 00000000..79d9fcd1 --- /dev/null +++ b/api/tacticalrmm/checks/migrations/0029_alter_checkresult_alert_severity.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.3 on 2022-04-15 21:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('checks', '0028_auto_20220401_2301'), + ] + + operations = [ + migrations.AlterField( + model_name='checkresult', + name='alert_severity', + field=models.CharField(blank=True, choices=[('info', 'Informational'), ('warning', 'Warning'), ('error', 'Error')], max_length=15, null=True), + ), + ] diff --git a/api/tacticalrmm/checks/models.py b/api/tacticalrmm/checks/models.py index 5d213c60..bfed734f 100644 --- a/api/tacticalrmm/checks/models.py +++ b/api/tacticalrmm/checks/models.py @@ -382,7 +382,6 @@ class CheckResult(models.Model): alert_severity = models.CharField( max_length=15, choices=SEVERITY_CHOICES, - default="warning", null=True, blank=True, )