# Generated by Django 4.2 on 2025-04-28 20:22

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("api", "0019_alter_graph_user"),
    ]

    operations = [
        migrations.CreateModel(
            name="Alert",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("create_time", models.DateTimeField(auto_now_add=True)),
                ("update_time", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(default="未命名告警规则", max_length=64)),
                (
                    "level",
                    models.CharField(
                        choices=[("system", "系统级"), ("process", "进程级")],
                        default="system",
                        max_length=16,
                    ),
                ),
                (
                    "indicator",
                    models.CharField(
                        choices=[("cpu", "cpu使用率"), ("mem", "内存占用"), ("disk", "硬盘占用")],
                        default="cpu",
                        max_length=16,
                    ),
                ),
                ("threshold", models.FloatField()),
                (
                    "handle",
                    models.CharField(
                        choices=[
                            ("noAction", "不做处理"),
                            ("closeLatest", "关闭最新进程"),
                            ("closeHighestCpu", "关闭CPU占用最高进程"),
                            ("closeHighestMem", "关闭MEM占用最高进程"),
                        ],
                        default="noAction",
                        max_length=16,
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[("enable", "启用"), ("disable", "未启用")],
                        default="disable",
                        max_length=16,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SystemPerformance",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("cpu", models.FloatField()),
                ("mem_total", models.FloatField()),
                ("mem_used", models.FloatField()),
                ("create_time", models.DateTimeField(auto_now_add=True)),
            ],
        ),
    ]
