<reponame>xjlin0/attendees
# Generated by Django 3.0.2 on 2020-01-13 02:58
from uuid import uuid4
# import attendees.persons.models.enum
# import attendees.persons.models.utility
from django.conf import settings
from django.db import migrations, models
from django.contrib.postgres.fields.jsonb import JSONField
from private_storage.fields import PrivateFileField
from private_storage.storage.files import PrivateFileSystemStorage
import django.utils.timezone
import model_utils.fields

from attendees.persons.models.enum import GenderEnum
from attendees.persons.models import utility


class Migration(migrations.Migration):

    dependencies = [
        ('persons', '0004_family'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Attendee',
            fields=[
                ('user', models.OneToOneField(blank=True, default=None, null=True, on_delete=models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('id', model_utils.fields.UUIDField(default=uuid4, editable=False, primary_key=True, serialize=False)),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('is_removed', models.BooleanField(default=False)),
                ('first_name', models.CharField(blank=True, db_index=True, max_length=25, null=True)),
                ('last_name', models.CharField(blank=True, db_index=True, max_length=25, null=True)),
                ('first_name2', models.CharField(blank=True, db_index=True, max_length=12, null=True)),
                ('last_name2', models.CharField(blank=True, db_index=True, max_length=8, null=True)),
                ('gender', models.CharField(choices=GenderEnum.choices(), default=GenderEnum.UNSPECIFIED, max_length=11)),
                ('actual_birthday', models.DateField(blank=True, null=True)),
                ('estimated_birthday', models.DateField(blank=True, null=True)),
                ('deathday', models.DateField(blank=True, null=True)),
                ('progressions', JSONField(blank=True, default=dict, help_text='Example: {"Christian": true, "baptized": {"time": "12/31/2020", "place":"SF"}}. Please keep {} here even no data', null=True)),
                ('photo', PrivateFileField(blank=True, null=True, storage=PrivateFileSystemStorage(), upload_to='attendees', verbose_name='Photo')),
                ('infos', JSONField(blank=True, default=dict, help_text='Example: {"food allergy": "peanuts", "public_name": "John", "other_name": "Apostle"}. Please keep {} here even no data', null=True)),
            ],
            options={
                'db_table': 'persons_attendees',
                'ordering': ['last_name', 'first_name'],
            },
            bases=(utility.Utility, models.Model),
        ),
        migrations.AddIndex(
            model_name='attendee',
            index=django.contrib.postgres.indexes.GinIndex(fields=['infos'], name='attendee_infos_gin'),
        ),
        migrations.AddIndex(
            model_name='attendee',
            index=django.contrib.postgres.indexes.GinIndex(fields=['progressions'], name='attendee_progressions_gin'),
        ),
    ]
