# Generated by Django 3.1.4 on 2021-01-31 13:06

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AuthorReview',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fio', models.CharField(default='', max_length=128)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_county', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('genre_name', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='MovieRole',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tag_name', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='MovieFigure',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fio', models.CharField(max_length=128)),
                ('role', models.ManyToManyField(related_name='role_figure', to='catalog.MovieRole')),
            ],
        ),
        migrations.CreateModel(
            name='Film',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('movie_title', models.CharField(max_length=32, unique=True)),
                ('production_year', models.DateField()),
                ('image', models.ImageField(blank=True, default='cinema.jpg', null=True, upload_to='catalog')),
                ('budget', models.DecimalField(decimal_places=2, max_digits=8)),
                ('worldwide_gross', models.DecimalField(decimal_places=2, max_digits=8)),
                ('duration', models.DurationField()),
                ('actor', models.ManyToManyField(related_name='actors', to='catalog.MovieFigure')),
                ('country', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='catalog.country')),
                ('director', models.ManyToManyField(related_name='director', to='catalog.MovieFigure')),
                ('genre', models.ManyToManyField(to='catalog.Genre')),
                ('producer', models.ManyToManyField(related_name='producer', to='catalog.MovieFigure')),
                ('tag', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='catalog.tag')),
            ],
            options={
                'unique_together': {('movie_title', 'production_year')},
            },
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('film_review_title', models.CharField(max_length=256)),
                ('film_review', models.TextField()),
                ('rating', models.PositiveSmallIntegerField(blank=True, default=0, null=True)),
                ('author_review', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='review', to='catalog.authorreview')),
                ('film', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='catalog.film')),
            ],
            options={
                'unique_together': {('film_review', 'film_review_title')},
            },
        ),
    ]
