# Generated by Django 4.1.2 on 2022-10-05 13:24

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="MagicLink",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "secret_identifier",
                    models.CharField(
                        default=uuid.UUID("948c2d9f-77a4-45e2-957e-4986df8587a3"),
                        editable=False,
                        max_length=512,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("expires_at", models.DateTimeField()),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Magic Link",
                "verbose_name_plural": "Magic Links",
                "get_latest_by": ["-created_at"],
            },
        ),
        migrations.AddIndex(
            model_name="magiclink",
            index=models.Index(fields=["secret_identifier"], name="magic_link_idx"),
        ),
    ]
