# Generated by Django 4.2.5 on 2023-10-07 08:17

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.UUIDField(primary_key=True, serialize=False)),
                ('type', models.CharField(max_length=50)),
                ('content', models.JSONField(blank=True, null=True)),
                ('status', models.CharField(choices=[('queuing', 'queuing'), ('processing', 'processing'), ('sent', 'sent'), ('exception', 'exception'), ('no_handler', 'no_handler')], default='queuing', max_length=20)),
                ('update_at', models.DateTimeField(auto_now=True)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('version', ool.VersionField(default=0)),
            ],
            options={
                'ordering': ('-create_at',),
                'get_latest_by': 'create_at',
            },
            bases=(ool.VersionedMixin, models.Model),
        ),
        migrations.CreateModel(
            name='MessageLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.JSONField(blank=True, null=True)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ymessage.message')),
            ],
            options={
                'ordering': ('id',),
            },
        ),
        migrations.AddIndex(
            model_name='message',
            index=models.Index(fields=['create_at'], name='idx_message__create_at'),
        ),
    ]
