# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-17 11:38
from __future__ import unicode_literals

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


def create_themes(apps, schema_editor):
    Theme = apps.get_model("video", "Theme")
    db_alias = schema_editor.connection.alias
    Theme.objects.using(db_alias).bulk_create([
        Theme(name='Sci-fi'),
        Theme(name='Development'),
        Theme(name='Natural'),
        Theme(name='Python'),
        Theme(name='Hi-Tech')
    ])


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_positive', models.BooleanField(default=False)),
                ('time', models.TimeField(auto_now_add=True)),
                ('comment', models.TextField(verbose_name='Comment')),
            ],
        ),
        migrations.CreateModel(
            name='Theme',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='Theme name')),
            ],
        ),
        migrations.CreateModel(
            name='Thumb',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_positive', models.BooleanField(default=False)),
                ('time', models.TimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Video',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('date_uploaded', models.DateField()),
                ('views', models.PositiveIntegerField(default=0, verbose_name='Number of views')),
                ('theme', models.ManyToManyField(blank=True, to='video.Theme')),
            ],
        ),
        migrations.AddField(
            model_name='thumb',
            name='video',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='thumbs', to='video.Video'),
        ),
        migrations.AddField(
            model_name='comment',
            name='video',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='video.Video'),
        ),

        migrations.RunPython(create_themes, ),
    ]
