# Generated by Django 5.2.11 on 2026-03-19 18:52

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0022_backfill_thread_messaged_at'),
    ]

    operations = [
        migrations.CreateModel(
            name='ThreadEvent',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='primary key for the record as UUID', primary_key=True, serialize=False, verbose_name='id')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='date and time at which a record was created', verbose_name='created on')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='date and time at which a record was last updated', verbose_name='updated on')),
                ('type', models.CharField(choices=[('im', 'Instant message')], max_length=36, verbose_name='type')),
                ('data', models.JSONField(blank=True, default=dict, verbose_name='data')),
                ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='thread_events', to=settings.AUTH_USER_MODEL)),
                ('channel', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='thread_events', to='core.channel')),
                ('message', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='thread_events', to='core.message')),
                ('thread', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='core.thread')),
            ],
            options={
                'verbose_name': 'thread event',
                'verbose_name_plural': 'thread events',
                'db_table': 'messages_threadevent',
                'ordering': ['created_at'],
                'indexes': [models.Index(fields=['thread', 'created_at'], name='messages_th_thread__83c471_idx')],
            },
        ),
    ]
