# Generated by Django 4.2 on 2025-03-25 11:43

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ("api", "0016_alter_result_edgefile_alter_result_nodefile"),
    ]

    operations = [
        migrations.CreateModel(
            name="Graph",
            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)),
                (
                    "type",
                    models.CharField(
                        choices=[
                            ("optimize", "optimize"),
                            ("group", "group"),
                            ("predict", "predict"),
                        ],
                        default="optimize",
                        max_length=16,
                    ),
                ),
                ("nodesMap", models.JSONField()),
                ("edgeMap", models.JSONField()),
                (
                    "result",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="own_graphs",
                        to="api.result",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="own_graphs",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="GraphToken",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("create_time", models.DateTimeField(auto_now_add=True)),
                ("token", models.CharField(max_length=8)),
                (
                    "graph",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="own_tokens",
                        to="api.graph",
                    ),
                ),
            ],
        ),
    ]
