# Generated by Django 2.2.6 on 2019-12-04 16:11

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.TextField()),
                ('desc', models.TextField(null=True)),
                ('qtype', models.IntegerField()),
                ('order', models.IntegerField()),
                ('required', models.BooleanField()),
                ('other', models.BooleanField()),
                ('image', models.ImageField(null=True, upload_to='question_image')),
                ('constraint', models.TextField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Survey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('desc', models.TextField()),
                ('createDate', models.DateTimeField(auto_now_add=True)),
                ('endDate', models.DateTimeField(blank=True, default=None, null=True)),
                ('anonymous', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='User_survey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('owner', models.BooleanField(default=True)),
                ('add_collab', models.BooleanField(default=True)),
                ('survey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Survey')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Section',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('section_no', models.IntegerField()),
                ('title', models.CharField(max_length=100)),
                ('desc', models.TextField()),
                ('survey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Survey')),
            ],
        ),
        migrations.CreateModel(
            name='Row',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.TextField()),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Question')),
            ],
        ),
        migrations.CreateModel(
            name='Response',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('response_time', models.DateTimeField(default=datetime.datetime.now)),
                ('other', models.TextField(null=True)),
                ('file', models.FileField(null=True, upload_to='response_files')),
                ('date', models.DateField(null=True)),
                ('time', models.TimeField(null=True)),
                ('options', models.TextField(null=True)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Question')),
                ('row', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='user.Row')),
                ('survey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Survey')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='question',
            name='section',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Section'),
        ),
        migrations.CreateModel(
            name='Option',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.TextField()),
                ('image', models.ImageField(upload_to='option_image')),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Question')),
            ],
        ),
    ]
