# Generated by Django 2.2.13 on 2021-08-13 10:40

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


class Migration(migrations.Migration):

    dependencies = [
        ("children", "0006_add_languages_spoken_at_home"),
        ("events", "0021_nullable_capacity_per_occurrence"),
    ]

    operations = [
        migrations.CreateModel(
            name="TicketSystemPassword",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="created at"),
                ),
                (
                    "assigned_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="assigned at"
                    ),
                ),
                ("value", models.CharField(max_length=64, verbose_name="value")),
                (
                    "child",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ticket_system_passwords",
                        to="children.Child",
                        verbose_name="child",
                    ),
                ),
                (
                    "event",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="ticket_system_passwords",
                        to="events.Event",
                        verbose_name="event",
                    ),
                ),
            ],
            options={
                "verbose_name": "ticket system password",
                "verbose_name_plural": "ticket system passwords",
                "ordering": ("id",),
            },
        ),
        migrations.AddConstraint(
            model_name="ticketsystempassword",
            constraint=models.UniqueConstraint(
                fields=("value", "event"), name="unique_password_value_event"
            ),
        ),
        migrations.AddConstraint(
            model_name="ticketsystempassword",
            constraint=models.UniqueConstraint(
                fields=("event", "child"), name="unique_password_event_child"
            ),
        ),
    ]
