<reponame>hackthevalley/hack-the-back
# Generated by Django 3.2.6 on 2021-08-09 22:04

import uuid

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

import hacktheback.core.models
import hacktheback.validators


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('answer', models.TextField(null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Form',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('start_at', models.DateTimeField()),
                ('end_at', models.DateTimeField()),
                ('title', models.CharField(max_length=128)),
                ('description', models.TextField()),
                ('type', models.CharField(choices=[('HA', 'Hacker Application'), ('MI', 'Miscellaneous')], default='MI', max_length=2)),
                ('is_draft', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='FormResponse',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_draft', models.BooleanField(default=True)),
                ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='forms.form')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='form_responses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(db_index=True, editable=False, verbose_name='order')),
                ('label', models.CharField(max_length=128)),
                ('type', models.CharField(choices=[('SHORT_TEXT', 'Short Text'), ('LONG_TEXT', 'Long Text'), ('SELECT', 'Select'), ('MULTISELECT', 'Multiselect'), ('RADIO', 'Radio'), ('HTTP_URL', 'HTTP URL'), ('PHONE', 'Phone'), ('EMAIL', 'Email'), ('PDF_FILE', 'PDF File'), ('IMAGE_FILE', 'Image File')], default='SHORT_TEXT', max_length=11)),
                ('description', models.TextField(help_text="A question's help text.", null=True)),
                ('placeholder', models.CharField(help_text="The value for a question's HTML placeholder.", max_length=128, null=True)),
                ('required', models.BooleanField(default=False)),
                ('default_answer', models.TextField(null=True)),
                ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='forms.form')),
            ],
            options={
                'ordering': ('order',),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='QuestionOption',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(db_index=True, editable=False, verbose_name='order')),
                ('label', models.CharField(max_length=128)),
                ('default_answer', models.BooleanField(default=False)),
                ('persist_deletion', models.BooleanField(default=False, help_text="The option has been deleted and won't be valid for future responses.")),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='forms.question')),
            ],
            options={
                'ordering': ('order',),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HackathonApplicant',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('status', models.CharField(choices=[('APPLYING', 'Applying'), ('APPLIED', 'Applied'), ('UNDER_REVIEW', 'Under Review'), ('ACCEPTED', 'Accepted')], default='APPLIED', max_length=12)),
                ('application', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='applicant', to='forms.formresponse')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='AnswerOption',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='selected_options', to='forms.answer')),
                ('option', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.questionoption')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='AnswerFile',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('file', models.FileField(upload_to=hacktheback.core.models.file_upload_to, validators=[hacktheback.validators.validate_file_size])),
                ('original_filename', models.CharField(max_length=260)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answer_files', to='forms.question')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='answer_files', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.question'),
        ),
        migrations.AddField(
            model_name='answer',
            name='response',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.formresponse'),
        ),
        migrations.AddConstraint(
            model_name='questionoption',
            constraint=models.UniqueConstraint(fields=('question', 'label'), name='unique_option_per_question'),
        ),
        migrations.AddConstraint(
            model_name='question',
            constraint=models.UniqueConstraint(fields=('form', 'label'), name='unique_question_per_form'),
        ),
    ]

# Generated by Django 3.2.6 on 2021-08-09 22:04

import uuid

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

import hacktheback.core.models
import hacktheback.validators


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('answer', models.TextField(null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Form',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('start_at', models.DateTimeField()),
                ('end_at', models.DateTimeField()),
                ('title', models.CharField(max_length=128)),
                ('description', models.TextField()),
                ('type', models.CharField(choices=[('HA', 'Hacker Application'), ('MI', 'Miscellaneous')], default='MI', max_length=2)),
                ('is_draft', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='FormResponse',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_draft', models.BooleanField(default=True)),
                ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='forms.form')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='form_responses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(db_index=True, editable=False, verbose_name='order')),
                ('label', models.CharField(max_length=128)),
                ('type', models.CharField(choices=[('SHORT_TEXT', 'Short Text'), ('LONG_TEXT', 'Long Text'), ('SELECT', 'Select'), ('MULTISELECT', 'Multiselect'), ('RADIO', 'Radio'), ('HTTP_URL', 'HTTP URL'), ('PHONE', 'Phone'), ('EMAIL', 'Email'), ('PDF_FILE', 'PDF File'), ('IMAGE_FILE', 'Image File')], default='SHORT_TEXT', max_length=11)),
                ('description', models.TextField(help_text="A question's help text.", null=True)),
                ('placeholder', models.CharField(help_text="The value for a question's HTML placeholder.", max_length=128, null=True)),
                ('required', models.BooleanField(default=False)),
                ('default_answer', models.TextField(null=True)),
                ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='forms.form')),
            ],
            options={
                'ordering': ('order',),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='QuestionOption',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(db_index=True, editable=False, verbose_name='order')),
                ('label', models.CharField(max_length=128)),
                ('default_answer', models.BooleanField(default=False)),
                ('persist_deletion', models.BooleanField(default=False, help_text="The option has been deleted and won't be valid for future responses.")),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='forms.question')),
            ],
            options={
                'ordering': ('order',),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HackathonApplicant',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('status', models.CharField(choices=[('APPLYING', 'Applying'), ('APPLIED', 'Applied'), ('UNDER_REVIEW', 'Under Review'), ('ACCEPTED', 'Accepted')], default='APPLIED', max_length=12)),
                ('application', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='applicant', to='forms.formresponse')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='AnswerOption',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='selected_options', to='forms.answer')),
                ('option', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.questionoption')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='AnswerFile',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('file', models.FileField(upload_to=hacktheback.core.models.file_upload_to, validators=[hacktheback.validators.validate_file_size])),
                ('original_filename', models.CharField(max_length=260)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answer_files', to='forms.question')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='answer_files', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.question'),
        ),
        migrations.AddField(
            model_name='answer',
            name='response',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='forms.formresponse'),
        ),
        migrations.AddConstraint(
            model_name='questionoption',
            constraint=models.UniqueConstraint(fields=('question', 'label'), name='unique_option_per_question'),
        ),
        migrations.AddConstraint(
            model_name='question',
            constraint=models.UniqueConstraint(fields=('form', 'label'), name='unique_question_per_form'),
        ),
    ]
# Generated by Django 3.2.6 on 2021-08-09 22:04