# Generated by Django 5.0.6 on 2024-05-30 18:51

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


class Migration(migrations.Migration):

    dependencies = [
        ('django_ai_assistant', '0002_assistant_cls_synced_at_assistant_openai_synced_at'),
    ]

    operations = [
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message', models.JSONField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'Message',
                'verbose_name_plural': 'Messages',
                'ordering': ('-created_at',),
            },
        ),
        migrations.DeleteModel(
            name='Assistant',
        ),
        migrations.RemoveField(
            model_name='thread',
            name='openai_id',
        ),
        migrations.AddField(
            model_name='message',
            name='thread',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='django_ai_assistant.thread'),
        ),
        migrations.AddIndex(
            model_name='message',
            index=models.Index(models.OrderBy(models.F('created_at'), descending=True), name='message_created_at_desc'),
        ),
    ]
