# Generated by Django 3.0.6 on 2020-07-12 09:32

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Error',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.TextField()),
                ('error', models.TextField()),
                ('extra_info', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event_key', models.CharField(max_length=254)),
                ('event_desc', models.CharField(max_length=254)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Match',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('match_date', models.CharField(max_length=254)),
                ('ppstatus', models.CharField(max_length=254)),
                ('m_time', models.CharField(max_length=254)),
                ('venue', models.TextField()),
                ('m_number', models.CharField(max_length=254)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='MatchEvent', to='tabletennis.Event')),
            ],
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('player_id', models.CharField(max_length=200, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('player_key', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='playermain', to='players.Player')),
            ],
        ),
        migrations.CreateModel(
            name='RawData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('url', models.TextField()),
                ('raw_data', django_mysql.models.JSONField(default=dict)),
                ('tour_type', models.CharField(max_length=254)),
                ('is_finished', models.BooleanField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='TTCompetition',
            fields=[
                ('tour_id', models.CharField(max_length=254, primary_key=True, serialize=False)),
                ('finished', models.BooleanField()),
                ('gender', models.CharField(max_length=254)),
                ('m_type', models.CharField(max_length=254)),
                ('startdate', models.CharField(max_length=254)),
                ('enddate', models.CharField(max_length=254)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('competition_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='competitionid', to='players.Competition')),
            ],
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('player_1', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='P1Team', to='tabletennis.Player')),
                ('player_2', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='P2Team', to='tabletennis.Player')),
            ],
        ),
        migrations.CreateModel(
            name='Single',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('away', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='AwayPly', to='tabletennis.Player')),
                ('home', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='HomePly', to='tabletennis.Player')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='SingleMatch', to='tabletennis.Match')),
            ],
        ),
        migrations.CreateModel(
            name='RawMatchData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_json', django_mysql.models.JSONField(default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('tt_champ', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TTCompRawData', to='tabletennis.TTCompetition')),
            ],
        ),
        migrations.CreateModel(
            name='Phase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phase_key', models.CharField(max_length=254)),
                ('phase_desc', models.CharField(max_length=254)),
                ('phase_evkey', models.CharField(max_length=254)),
                ('phase_type', models.CharField(max_length=254)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('champ_phase', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TTCompPhase', to='tabletennis.TTCompetition')),
            ],
        ),
        migrations.CreateModel(
            name='MatchUrl',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('match_url', models.TextField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('champ_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TTCompUrls', to='tabletennis.TTCompetition')),
            ],
        ),
        migrations.CreateModel(
            name='MatchScrapingError',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('error', models.TextField()),
                ('desc', models.TextField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('champ', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ChampError', to='tabletennis.TTCompetition')),
            ],
        ),
        migrations.AddField(
            model_name='match',
            name='phase',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='MatchPhase', to='tabletennis.Phase'),
        ),
        migrations.AddField(
            model_name='match',
            name='tourn_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TTCompMatch', to='tabletennis.TTCompetition'),
        ),
        migrations.AddField(
            model_name='event',
            name='champ_events',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TTCompEvent', to='tabletennis.TTCompetition'),
        ),
        migrations.CreateModel(
            name='Double',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('away_T', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='AwayTeam', to='tabletennis.Team')),
                ('home_T', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='HomeTeam', to='tabletennis.Team')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='DoubleMatch', to='tabletennis.Match')),
            ],
        ),
    ]
