# Generated by Django 5.1.10 on 2025-08-29 22:57

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


class Migration(migrations.Migration):
    dependencies = [
        ("database", "0098_alter_texttoimagemodelconfig_model_type"),
    ]

    operations = [
        migrations.CreateModel(
            name="UserMemory",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("embeddings", pgvector.django.VectorField()),
                ("raw", models.TextField()),
                (
                    "agent",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="database.agent",
                    ),
                ),
                (
                    "search_model",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="database.searchmodelconfig",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="userconversationconfig",
            name="enable_memory",
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name="serverchatsettings",
            name="memory_mode",
            field=models.CharField(
                choices=[
                    ("disabled", "Disabled"),
                    ("enabled_default_off", "Enabled, default off"),
                    ("enabled_default_on", "Enabled, default on"),
                ],
                default="enabled_default_on",
                help_text="Server-level memory feature configuration. Disabled overrides user preference.",
                max_length=20,
            ),
        ),
    ]
