# Generated by Django 2.1.4 on 2018-12-22 16:24

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


class Migration(migrations.Migration):

    dependencies = [
        ('main', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('answer', models.CharField(max_length=1)),
                ('right', models.BooleanField(default=False)),
            ],
            options={
                'verbose_name': 'Answer',
                'db_table': 'db_answer',
            },
        ),
        migrations.CreateModel(
            name='Bot',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='main.User')),
                ('token', models.CharField(max_length=50)),
                ('offset', models.IntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Bot',
                'db_table': 'db_bot',
            },
            bases=('main.user',),
        ),
        migrations.CreateModel(
            name='BotBinding',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Bot')),
            ],
            options={
                'verbose_name': 'Bot Bindings',
                'db_table': 'db_bot_bindings',
            },
        ),
        migrations.CreateModel(
            name='Discipline',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70)),
                ('value', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Discipline',
                'db_table': 'db_discipline',
            },
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(max_length=100)),
                ('title', models.CharField(max_length=150)),
            ],
            options={
                'verbose_name': 'Group',
                'db_table': 'db_group',
            },
        ),
        migrations.CreateModel(
            name='GroupType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
            options={
                'verbose_name': 'Group Type',
                'db_table': 'db_group_type',
            },
        ),
        migrations.CreateModel(
            name='Participant',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='main.User')),
                ('score', models.IntegerField(default=0)),
                ('joined', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Participant',
                'db_table': 'db_participant',
            },
            bases=('main.user',),
        ),
        migrations.CreateModel(
            name='ParticipantGroupBinding',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Group')),
                ('participant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Participant')),
            ],
            options={
                'verbose_name': 'Participant-Group Bindings',
                'db_table': 'db_participant_group_bindings',
            },
        ),
        migrations.CreateModel(
            name='Problem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('formulation', models.CharField(max_length=1500)),
                ('variant_a', models.CharField(max_length=150)),
                ('variant_b', models.CharField(max_length=150)),
                ('variant_c', models.CharField(max_length=150)),
                ('variant_d', models.CharField(max_length=150)),
                ('variant_e', models.CharField(max_length=150)),
                ('answer_formulation', models.CharField(max_length=3000)),
                ('right_variant', models.CharField(max_length=1)),
            ],
            options={
                'verbose_name': 'Problem',
                'db_table': 'db_problem',
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('value', models.CharField(max_length=50)),
                ('priority_level', models.IntegerField(default=1)),
            ],
            options={
                'verbose_name': 'Roles',
                'db_table': 'db_role',
            },
        ),
        migrations.CreateModel(
            name='Subject',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70)),
                ('value', models.CharField(max_length=100)),
                ('discipline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Discipline')),
            ],
            options={
                'verbose_name': 'Subject',
                'db_table': 'db_subject',
            },
        ),
        migrations.CreateModel(
            name='SubjectGroupBindings',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Group')),
                ('last_problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Problem')),
                ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Subject')),
            ],
            options={
                'verbose_name': 'Subject-Group Bindings',
                'db_table': 'db_subject_group_bindings',
            },
        ),
        migrations.AlterModelOptions(
            name='user',
            options={'verbose_name': 'User'},
        ),
        migrations.RemoveField(
            model_name='user',
            name='telegram_id',
        ),
        migrations.AddField(
            model_name='user',
            name='first_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AddField(
            model_name='user',
            name='last_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AddField(
            model_name='user',
            name='username',
            field=models.CharField(blank=True, max_length=100, null=True),
        ),
        migrations.AlterModelTable(
            name='user',
            table='db_user',
        ),
        migrations.AddField(
            model_name='problem',
            name='subject',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Subject'),
        ),
        migrations.AddField(
            model_name='participantgroupbinding',
            name='role',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Role'),
        ),
        migrations.AddField(
            model_name='group',
            name='type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.GroupType'),
        ),
        migrations.AddField(
            model_name='botbinding',
            name='group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Group'),
        ),
        migrations.AddField(
            model_name='answer',
            name='problem',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Problem'),
        ),
        migrations.AddField(
            model_name='answer',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Participant'),
        ),
    ]
