# Generated by Django 4.2 on 2024-04-23 03:20

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


class Migration(migrations.Migration):

    replaces = [
        ('tickets', '0002_initial'),
        ('tickets', '0003_rename_session_id_ticket_session_and_more'),
        ('tickets', '0004_rename_user_ticket_profile'),
        ('tickets', '0005_alter_ticket_options_alter_ticket_table'),
        (
            'tickets',
            '0006_remove_ticket_profile_remove_ticket_session_and_more',
        ),
        ('tickets', '0007_alter_order_datetime_order'),
    ]

    dependencies = [
        ('timetable', '0002_rename_rows_row_filmsession'),
        ('tickets', '0001_initial'),
        ('users', '0001_initial'),
        ('users', '0003_remove_profile_genres_profile_genres'),
        ('timetable', '0006_remove_auditorium_row_count'),
    ]

    operations = [
        migrations.AddField(
            model_name='ticket',
            name='session',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='tickets',
                related_query_name='tickets',
                to='timetable.filmsession',
            ),
        ),
        migrations.AddField(
            model_name='ticket',
            name='profile',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='tickets',
                related_query_name='tickets',
                to='users.profile',
            ),
        ),
        migrations.AlterModelOptions(
            name='ticket',
            options={'verbose_name': 'Билет', 'verbose_name_plural': 'Билеты'},
        ),
        migrations.AlterModelTable(
            name='ticket',
            table='tickets_ticket',
        ),
        migrations.RemoveField(
            model_name='ticket',
            name='profile',
        ),
        migrations.RemoveField(
            model_name='ticket',
            name='session',
        ),
        migrations.AlterModelTable(
            name='ticket',
            table='tickets_tickets',
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'datetime_order',
                    models.DateTimeField(
                        help_text='Дата и время оформления заказа',
                        verbose_name='Дата и время оформления заказа',
                    ),
                ),
                (
                    'profile',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='orders',
                        related_query_name='orders',
                        to='users.profile',
                    ),
                ),
                (
                    'session',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='orders',
                        related_query_name='orders',
                        to='timetable.filmsession',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Заказ',
                'verbose_name_plural': 'Заказы',
                'db_table': 'tickets_orders',
            },
        ),
        migrations.AddField(
            model_name='ticket',
            name='order',
            field=models.ForeignKey(
                default='',
                on_delete=django.db.models.deletion.CASCADE,
                related_name='tickets',
                related_query_name='tickets',
                to='tickets.order',
            ),
            preserve_default=False,
        ),
    ]
