# Generated by Django 2.2.24 on 2023-12-20 09:02

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('astrobin', '0185_add_bortle_4_5'),
    ]

    operations = [
        migrations.CreateModel(
            name='PopupMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256)),
                ('body', models.TextField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('active', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ('-created',),
            },
        ),
        migrations.CreateModel(
            name='PopupMessageUserStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('seen', models.DateTimeField(null=True)),
                ('popup_message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='astrobin.PopupMessage')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-popup_message__created',),
            },
        ),
        migrations.AddIndex(
            model_name='popupmessage',
            index=models.Index(fields=['active', '-created'], name='astrobin_po_active_755206_idx'),
        ),
        migrations.AddIndex(
            model_name='popupmessageuserstatus',
            index=models.Index(fields=['user', 'popup_message', 'seen'], name='astrobin_po_user_id_819122_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='popupmessageuserstatus',
            unique_together={('user', 'popup_message')},
        ),
    ]
