87 lines
3.2 KiB
Python
87 lines
3.2 KiB
Python
# Generated by Django 5.2.7 on 2026-03-02 00:00
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("core", "0027_businessplandocument_businessplanrevision_and_more"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="AIRunLog",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
("operation", models.CharField(blank=True, default="", max_length=64)),
|
|
("model", models.CharField(blank=True, default="", max_length=255)),
|
|
("base_url", models.CharField(blank=True, default="", max_length=255)),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[("running", "Running"), ("ok", "OK"), ("failed", "Failed")],
|
|
default="running",
|
|
max_length=16,
|
|
),
|
|
),
|
|
("message_count", models.PositiveIntegerField(default=0)),
|
|
("prompt_chars", models.PositiveIntegerField(default=0)),
|
|
("response_chars", models.PositiveIntegerField(default=0)),
|
|
("error", models.TextField(blank=True, default="")),
|
|
("started_at", models.DateTimeField(auto_now_add=True)),
|
|
("finished_at", models.DateTimeField(blank=True, null=True)),
|
|
("duration_ms", models.PositiveIntegerField(blank=True, null=True)),
|
|
(
|
|
"ai",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="run_logs",
|
|
to="core.ai",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="ai_run_logs",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="airunlog",
|
|
index=models.Index(fields=["user", "started_at"], name="core_airunl_user_id_6f4700_idx"),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="airunlog",
|
|
index=models.Index(
|
|
fields=["user", "status", "started_at"],
|
|
name="core_airunl_user_id_b4486e_idx",
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="airunlog",
|
|
index=models.Index(
|
|
fields=["user", "operation", "started_at"],
|
|
name="core_airunl_user_id_4f0f5e_idx",
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="airunlog",
|
|
index=models.Index(fields=["user", "model", "started_at"], name="core_airunl_user_id_953bff_idx"),
|
|
),
|
|
]
|