# Generated by Django 5.0.7 on 2024-08-13 19:41

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


class Migration(migrations.Migration):
    replaces = [
        ("confirmation", "0001_initial"),
        ("confirmation", "0002_realmcreationkey"),
        ("confirmation", "0003_emailchangeconfirmation"),
        ("confirmation", "0004_remove_confirmationmanager"),
        ("confirmation", "0005_confirmation_realm"),
        ("confirmation", "0006_realmcreationkey_presume_email_valid"),
        ("confirmation", "0007_add_indexes"),
        ("confirmation", "0008_confirmation_expiry_date"),
        ("confirmation", "0009_confirmation_expiry_date_backfill"),
        ("confirmation", "0010_alter_confirmation_expiry_date"),
        ("confirmation", "0011_alter_confirmation_expiry_date"),
        ("confirmation", "0012_alter_confirmation_id"),
        ("confirmation", "0013_alter_realmcreationkey_id"),
        ("confirmation", "0014_confirmation_confirmatio_content_80155a_idx"),
    ]

    initial = True

    dependencies = [
        ("contenttypes", "0001_initial"),
        ("zerver", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="RealmCreationKey",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "creation_key",
                    models.CharField(db_index=True, max_length=40, verbose_name="activation key"),
                ),
                (
                    "date_created",
                    models.DateTimeField(default=django.utils.timezone.now, verbose_name="created"),
                ),
                ("presume_email_valid", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="Confirmation",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("object_id", models.PositiveIntegerField(db_index=True)),
                ("date_sent", models.DateTimeField(db_index=True)),
                ("confirmation_key", models.CharField(db_index=True, max_length=40)),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype"
                    ),
                ),
                ("type", models.PositiveSmallIntegerField()),
                (
                    "realm",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
                    ),
                ),
                ("expiry_date", models.DateTimeField(db_index=True, null=True)),
            ],
            options={
                "unique_together": {("type", "confirmation_key")},
                "indexes": [
                    models.Index(
                        fields=["content_type", "object_id"], name="confirmatio_content_80155a_idx"
                    )
                ],
            },
        ),
    ]
