# Generated by Django 2.1.5 on 2019-02-07 00:52

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import re


class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Horse',
            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)),
                ('key', models.CharField(max_length=255, unique=True)),
                ('age', models.PositiveSmallIntegerField(null=True)),
                ('sex', models.CharField(choices=[('MALE', 'Male'), ('FEMALE', 'Female'), ('CASTRATED', 'Castrated'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('name', models.CharField(max_length=255, null=True)),
            ],
            options={
                'db_table': 'horses',
            },
        ),
        migrations.CreateModel(
            name='Jockey',
            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)),
                ('key', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'jockeys',
            },
        ),
        migrations.CreateModel(
            name='Owner',
            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)),
                ('key', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'owners',
            },
        ),
        migrations.CreateModel(
            name='Race',
            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)),
                ('key', models.CharField(max_length=255, unique=True)),
                ('racetrack', models.CharField(choices=[('SAPPORO', 'Sapporo'), ('HAKODATE', 'Hakodate'), ('FUMA', 'Fuma'), ('NIIGATA', 'Niigata'), ('TOKYO', 'Tokyo'), ('NAKAYAMA', 'Nakayama'), ('CHUKYO', 'Chukyo'), ('KYOTO', 'Kyoto'), ('HANSHIN', 'Hanshin'), ('OGURA', 'Ogura'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('impost_category', models.CharField(choices=[('HORSE_AGE', 'Horse age'), ('WEIGHT_FOR_AGE', 'Weight for age'), ('SET_WEIGHT', 'Set weight'), ('HANDICAP', 'Handicap'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('surface', models.CharField(choices=[('DIRT', 'Dirt'), ('TURF', 'Turf'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('course', models.CharField(choices=[('LEFT', 'Left'), ('RIGHT', 'Right'), ('STRAIGHT', 'Straight'), ('OBSTACLE', 'Obstacle'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('distance', models.PositiveSmallIntegerField()),
                ('number', models.PositiveSmallIntegerField()),
                ('race_class', models.CharField(choices=[('OPEN', 'Open'), ('U1600', 'Under 1600'), ('U1000', 'Under 1000'), ('U500', 'Under 500'), ('MAIDEN', 'Maiden'), ('UNRACED_MAIDEN', 'Unraced Maiden'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('grade', models.CharField(choices=[('G1', 'G1'), ('G2', 'G2'), ('G3', 'G3'), ('NA', 'Not applicable')], max_length=255)),
                ('datetime', models.DateTimeField()),
                ('weather', models.CharField(choices=[('CLOUDY', 'Cloudy'), ('RAINY', 'Rainy'), ('LIGHT_RAIN', 'Light rain'), ('SUNNY', 'Sunny'), ('SNOWY', 'Snowy'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('track_condition', models.CharField(choices=[('SLIGHTLY_HEAVY', 'Slightly heavy'), ('HEAVY', 'Heavy'), ('GOOD', 'Good'), ('BAD', 'Bad'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
                ('is_outside_racetrack', models.BooleanField()),
                ('is_regional_maiden_race', models.BooleanField()),
                ('is_winner_regional_horse_race', models.BooleanField()),
                ('is_regional_jockey_race', models.BooleanField()),
                ('is_foreign_horse_race', models.BooleanField()),
                ('is_foreign_trainer_horse_race', models.BooleanField()),
                ('is_apprentice_jockey_race', models.BooleanField()),
                ('is_female_only_race', models.BooleanField()),
            ],
            options={
                'db_table': 'races',
                'get_latest_by': '-datetime',
            },
        ),
        migrations.CreateModel(
            name='RaceContender',
            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)),
                ('order_of_finish', models.PositiveSmallIntegerField(null=True)),
                ('position_state', models.CharField(choices=[('OK', 'OK'), ('DISQUALIFIED', 'Disqualified'), ('CANCELLED', 'Cancelled'), ('REMOUNT', 'Remount'), ('NO_FINISH', 'Did not finish'), ('POSITION_LOWERED', 'Position lowered'), ('UNKNOWN', 'Unknown')], max_length=255)),
                ('post_position', models.PositiveSmallIntegerField()),
                ('horse_number', models.PositiveIntegerField()),
                ('weight_carried', models.FloatField()),
                ('finish_time', models.FloatField(null=True)),
                ('margin', models.CharField(choices=[('NOSE', 'Nose'), ('HEAD', 'Head'), ('NECK', 'Neck'), ('0.5', '0.5'), ('0.75', '0.75'), ('1.0', '1.0'), ('1.25', '1.25'), ('1.5', '1.5'), ('1.75', '1.75'), ('2.0', '2.0'), ('2.5', '2.5'), ('3.0', '3.0'), ('3.5', '3.5'), ('4.0', '4.0'), ('5.0', '5.0'), ('6.0', '6.0'), ('7.0', '7.0'), ('8.0', '8.0'), ('9.0', '9.0'), ('10.0', '10.0'), ('LARGE', 'Large'), ('UNKNOWN', 'Unknown')], max_length=255, null=True)),
                ('corner_pass_order', models.CharField(max_length=255, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')])),
                ('final_stage_time', models.FloatField(null=True)),
                ('first_place_odds', models.FloatField(null=True)),
                ('popularity', models.PositiveSmallIntegerField(null=True)),
                ('horse_weight', models.FloatField(null=True)),
                ('horse_weight_diff', models.FloatField(null=True)),
                ('purse', models.FloatField(default=0.0)),
                ('horse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netkeiba.Horse')),
                ('jockey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netkeiba.Jockey')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netkeiba.Owner')),
                ('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netkeiba.Race')),
            ],
            options={
                'db_table': 'race_contenders',
            },
        ),
        migrations.CreateModel(
            name='Trainer',
            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)),
                ('key', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
                ('stable', models.CharField(choices=[('EAST', 'East'), ('WEST', 'West'), ('REGIONAL', 'Regional'), ('OVERSEAS', 'Overseas'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=255)),
            ],
            options={
                'db_table': 'trainers',
            },
        ),
        migrations.AddField(
            model_name='racecontender',
            name='trainer',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netkeiba.Trainer'),
        ),
        migrations.AlterUniqueTogether(
            name='race',
            unique_together={('racetrack', 'datetime')},
        ),
        migrations.AlterUniqueTogether(
            name='racecontender',
            unique_together={('race', 'horse', 'jockey', 'trainer', 'owner')},
        ),
    ]
