# Generated by Django 2.2.6 on 2020-04-11 14:40

from django.conf import settings
import django.contrib.postgres.fields.jsonb
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='BaseQuestion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('response_type', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'integer'), (2, 'text'), (3, 'boolean')], help_text='hint for what type of response expect from end user', null=True)),
                ('topic', models.CharField(blank=True, choices=[('greeting', 'greeting'), ('information', 'information'), ('investigation', 'investigation'), ('general', 'general')], help_text='question topic', max_length=225, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('body', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('min_age_date', models.DateField(blank=True, help_text='minimal user birthday filter', null=True)),
                ('max_age_date', models.DateField(blank=True, help_text='maximum user birthday filter', null=True)),
                ('gender', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'female'), (2, 'male'), (3, 'unisex')], help_text='user gender filter', null=True)),
                ('body', models.TextField()),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('base_question', models.ForeignKey(help_text='the base question it can trace back to, one base question can have multiple version of questions', on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='myapp.BaseQuestion')),
            ],
        ),
        migrations.CreateModel(
            name='Response',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('body', models.CharField(max_length=1024)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='myapp.Question')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='QuestionChangeHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('before_body', models.TextField()),
                ('after_body', models.TextField()),
                ('diff', django.contrib.postgres.fields.jsonb.JSONField(blank=True, help_text='question text diff', null=True)),
                ('base_question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='question_change_histories', to='myapp.BaseQuestion')),
                ('question', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='question_change_histories', to='myapp.Question')),
            ],
        ),
    ]
