# Generated by Django 2.1.4 on 2019-01-01 16:37

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Club',
            fields=[
                ('name', models.CharField(max_length=20, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Coach',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('surname', models.CharField(max_length=50)),
                ('date_of_birth', models.DateField()),
            ],
        ),
        migrations.CreateModel(
            name='Footballer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('surname', models.CharField(max_length=50)),
                ('date_of_birth', models.DateField()),
                ('number', models.IntegerField()),
                ('club_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='footballers', to='core.Club')),
            ],
        ),
        migrations.CreateModel(
            name='Goal',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('minute', models.IntegerField()),
                ('assist_man', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assists', to='core.Footballer')),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('letter', models.CharField(max_length=1, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='GroupMatch',
            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, related_name='matches', to='core.Group')),
            ],
        ),
        migrations.CreateModel(
            name='KnockoutMatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('turn', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Match',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='home_matches', to='core.Club')),
            ],
        ),
        migrations.CreateModel(
            name='Presence',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_in_starting_XI', models.BooleanField()),
                ('footballer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='presences', to='core.Footballer')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='presences', to='core.Match')),
            ],
        ),
        migrations.CreateModel(
            name='RedCard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('minute', models.IntegerField()),
                ('expelled', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='red_cards', to='core.Footballer')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='red_cards', to='core.Match')),
            ],
        ),
        migrations.CreateModel(
            name='Referee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('surname', models.CharField(max_length=50)),
                ('date_of_birth', models.DateField()),
            ],
        ),
        migrations.CreateModel(
            name='Substitution',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='substitutions', to='core.Match')),
                ('replaced', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='substitutions', to='core.Footballer')),
                ('replacement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replacements', to='core.Footballer')),
            ],
        ),
        migrations.CreateModel(
            name='YellowCard',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('minute', models.IntegerField()),
                ('admonished', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='yellow_cards', to='core.Footballer')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='yellow_cards', to='core.Match')),
            ],
        ),
        migrations.AddField(
            model_name='match',
            name='referee',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='matches', to='core.Referee'),
        ),
        migrations.AddField(
            model_name='match',
            name='second_club',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='away_matches', to='core.Club'),
        ),
        migrations.AddField(
            model_name='knockoutmatch',
            name='match',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='knockout_matches', to='core.Match'),
        ),
        migrations.AddField(
            model_name='groupmatch',
            name='match',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='group_matches', to='core.Match'),
        ),
        migrations.AddField(
            model_name='goal',
            name='match',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='goals', to='core.Match'),
        ),
        migrations.AddField(
            model_name='goal',
            name='scorer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='goals', to='core.Footballer'),
        ),
        migrations.AddField(
            model_name='club',
            name='coach',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='coach', to='core.Coach'),
        ),
        migrations.AddField(
            model_name='club',
            name='group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='clubs', to='core.Group'),
        ),
        migrations.AlterUniqueTogether(
            name='groupmatch',
            unique_together={('group', 'match')},
        ),
        migrations.AlterUniqueTogether(
            name='footballer',
            unique_together={('club_name', 'number')},
        ),
    ]
