# Generated by Django 3.1.5 on 2021-01-29 18:44

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Game',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('match_date', models.DateField()),
                ('tie', models.IntegerField()),
            ],
            options={
                'db_table': 'game',
            },
        ),
        migrations.CreateModel(
            name='HeadCoach',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('last_name', models.CharField(blank=True, max_length=50, null=True)),
            ],
            options={
                'db_table': 'head_coach',
            },
        ),
        migrations.CreateModel(
            name='League',
            fields=[
                ('league_id', models.AutoField(primary_key=True, serialize=False)),
                ('start_date', models.DateField()),
            ],
            options={
                'db_table': 'league',
            },
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('last_name', models.CharField(blank=True, max_length=50, null=True)),
                ('birth_date', models.DateField(blank=True, null=True)),
            ],
            options={
                'db_table': 'player',
            },
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('score', models.IntegerField()),
                ('goals_scored', models.IntegerField()),
                ('goals_received', models.IntegerField()),
                ('ties', models.IntegerField()),
                ('wins', models.IntegerField()),
                ('looses', models.IntegerField()),
                ('coach', models.ForeignKey(db_column='coach', on_delete=django.db.models.deletion.PROTECT, to='team_player.headcoach')),
            ],
            options={
                'db_table': 'team',
            },
        ),
        migrations.CreateModel(
            name='Substitute',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('minute', models.IntegerField(blank=True, null=True)),
                ('gameid', models.ForeignKey(db_column='GameID', on_delete=django.db.models.deletion.PROTECT, to='team_player.game')),
                ('player1', models.ForeignKey(db_column='Player1', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='team_player.player')),
                ('player2', models.ForeignKey(db_column='Player2', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='team_player.player')),
            ],
            options={
                'db_table': 'substitute',
            },
        ),
        migrations.AddField(
            model_name='player',
            name='teamid',
            field=models.ForeignKey(db_column='TeamID', on_delete=django.db.models.deletion.PROTECT, to='team_player.team'),
        ),
        migrations.CreateModel(
            name='Goal',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('minute', models.IntegerField(blank=True, null=True)),
                ('gameid', models.ForeignKey(db_column='GameID', on_delete=django.db.models.deletion.PROTECT, to='team_player.game')),
                ('playerid', models.ForeignKey(db_column='PlayerID', on_delete=django.db.models.deletion.PROTECT, to='team_player.player')),
            ],
            options={
                'db_table': 'goal',
            },
        ),
        migrations.AddField(
            model_name='game',
            name='team1',
            field=models.ForeignKey(db_column='Team1', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='team_player.team'),
        ),
        migrations.AddField(
            model_name='game',
            name='team2',
            field=models.ForeignKey(db_column='Team2', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='team_player.team'),
        ),
        migrations.AddField(
            model_name='game',
            name='winner',
            field=models.ForeignKey(blank=True, db_column='winner', null=True, on_delete=django.db.models.deletion.PROTECT, to='team_player.team'),
        ),
        migrations.CreateModel(
            name='CoachAssistant',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('last_name', models.CharField(blank=True, max_length=50, null=True)),
                ('teamid', models.ForeignKey(db_column='TeamID', null=True, on_delete=django.db.models.deletion.SET_NULL, to='team_player.team')),
            ],
            options={
                'db_table': 'coach_assistant',
            },
        ),
        migrations.CreateModel(
            name='Card',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('card_type', models.CharField(blank=True, max_length=50, null=True)),
                ('gameid', models.ForeignKey(db_column='GameID', on_delete=django.db.models.deletion.PROTECT, to='team_player.game')),
                ('playerid', models.ForeignKey(db_column='PlayerID', on_delete=django.db.models.deletion.PROTECT, to='team_player.player')),
            ],
            options={
                'db_table': 'card',
            },
        ),
        migrations.CreateModel(
            name='TeamLeague',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('league', models.ForeignKey(db_column='League_id', on_delete=django.db.models.deletion.PROTECT, to='team_player.league')),
                ('teamid', models.OneToOneField(db_column='TeamID', on_delete=django.db.models.deletion.PROTECT, to='team_player.team')),
            ],
            options={
                'db_table': 'team_league',
                'unique_together': {('teamid', 'league')},
            },
        ),
    ]
