# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-19 15:17
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Leave',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField(auto_now_add=True, verbose_name='Время')),
                ('place', models.PositiveSmallIntegerField(verbose_name='Место')),
            ],
            options={
                'verbose_name_plural': 'Выходы',
                'ordering': ('-match_id', '-time'),
                'verbose_name': 'Выход',
            },
        ),
        migrations.CreateModel(
            name='Match',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.DateTimeField(auto_now_add=True, verbose_name='Время начала')),
                ('end_time', models.DateTimeField(blank=True, null=True, verbose_name='Время окончания')),
            ],
            options={
                'verbose_name_plural': 'Матчи',
                'ordering': ('-start_time',),
                'verbose_name': 'Матч',
            },
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Имя')),
            ],
            options={
                'verbose_name_plural': 'Игроки',
                'ordering': ('name',),
                'verbose_name': 'Игрок',
            },
        ),
        migrations.CreateModel(
            name='Round',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.DateTimeField(auto_now_add=True, verbose_name='Время начала')),
                ('end_time', models.DateTimeField(blank=True, null=True, verbose_name='Время окончания')),
                ('match', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='match.Match', verbose_name='Матч')),
                ('winner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='match.Player', verbose_name='Победитель')),
            ],
            options={
                'verbose_name_plural': 'Раунды',
                'ordering': ('-start_time',),
                'verbose_name': 'Раунд',
            },
        ),
        migrations.AddField(
            model_name='match',
            name='players',
            field=models.ManyToManyField(to='match.Player', verbose_name='Игроки'),
        ),
        migrations.AddField(
            model_name='leave',
            name='match',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='match.Match', verbose_name='Матч'),
        ),
        migrations.AddField(
            model_name='leave',
            name='player',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='match.Player', verbose_name='Игрок'),
        ),
    ]
