# Generated by Django 5.2.5 on 2025-08-24 19:11

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


class Migration(migrations.Migration):
    dependencies = [
        ("parks", "0006_remove_company_insert_insert_and_more"),
        ("pghistory", "0006_delete_aggregateevent"),
        ("rides", "0003_remove_company_insert_insert_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="RideEvent",
            fields=[
                ("pgh_id", models.AutoField(primary_key=True, serialize=False)),
                ("pgh_created_at", models.DateTimeField(auto_now_add=True)),
                ("pgh_label", models.TextField(help_text="The event label.")),
                ("id", models.BigIntegerField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=255)),
                ("slug", models.SlugField(db_index=False, max_length=255)),
                ("description", models.TextField(blank=True)),
                (
                    "category",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("", "Select ride type"),
                            ("RC", "Roller Coaster"),
                            ("DR", "Dark Ride"),
                            ("FR", "Flat Ride"),
                            ("WR", "Water Ride"),
                            ("TR", "Transport"),
                            ("OT", "Other"),
                        ],
                        default="",
                        max_length=2,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("", "Select status"),
                            ("OPERATING", "Operating"),
                            ("CLOSED_TEMP", "Temporarily Closed"),
                            ("SBNO", "Standing But Not Operating"),
                            ("CLOSING", "Closing"),
                            ("CLOSED_PERM", "Permanently Closed"),
                            ("UNDER_CONSTRUCTION", "Under Construction"),
                            ("DEMOLISHED", "Demolished"),
                            ("RELOCATED", "Relocated"),
                        ],
                        default="OPERATING",
                        max_length=20,
                    ),
                ),
                (
                    "post_closing_status",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("SBNO", "Standing But Not Operating"),
                            ("CLOSED_PERM", "Permanently Closed"),
                        ],
                        help_text="Status to change to after closing date",
                        max_length=20,
                        null=True,
                    ),
                ),
                ("opening_date", models.DateField(blank=True, null=True)),
                ("closing_date", models.DateField(blank=True, null=True)),
                ("status_since", models.DateField(blank=True, null=True)),
                ("min_height_in", models.PositiveIntegerField(blank=True, null=True)),
                ("max_height_in", models.PositiveIntegerField(blank=True, null=True)),
                (
                    "capacity_per_hour",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                (
                    "ride_duration_seconds",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                (
                    "average_rating",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=3, null=True),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelEvent",
            fields=[
                ("pgh_id", models.AutoField(primary_key=True, serialize=False)),
                ("pgh_created_at", models.DateTimeField(auto_now_add=True)),
                ("pgh_label", models.TextField(help_text="The event label.")),
                ("id", models.BigIntegerField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=255)),
                ("description", models.TextField(blank=True)),
                (
                    "category",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("", "Select ride type"),
                            ("RC", "Roller Coaster"),
                            ("DR", "Dark Ride"),
                            ("FR", "Flat Ride"),
                            ("WR", "Water Ride"),
                            ("TR", "Transport"),
                            ("OT", "Other"),
                        ],
                        default="",
                        max_length=2,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RollerCoasterStatsEvent",
            fields=[
                ("pgh_id", models.AutoField(primary_key=True, serialize=False)),
                ("pgh_created_at", models.DateTimeField(auto_now_add=True)),
                ("pgh_label", models.TextField(help_text="The event label.")),
                ("id", models.BigIntegerField()),
                (
                    "height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "length_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True),
                ),
                (
                    "speed_mph",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
                ),
                ("inversions", models.PositiveIntegerField(default=0)),
                (
                    "ride_time_seconds",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                ("track_type", models.CharField(blank=True, max_length=255)),
                (
                    "track_material",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("STEEL", "Steel"),
                            ("WOOD", "Wood"),
                            ("HYBRID", "Hybrid"),
                        ],
                        default="STEEL",
                        max_length=20,
                    ),
                ),
                (
                    "roller_coaster_type",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("SITDOWN", "Sit Down"),
                            ("INVERTED", "Inverted"),
                            ("FLYING", "Flying"),
                            ("STANDUP", "Stand Up"),
                            ("WING", "Wing"),
                            ("DIVE", "Dive"),
                            ("FAMILY", "Family"),
                            ("WILD_MOUSE", "Wild Mouse"),
                            ("SPINNING", "Spinning"),
                            ("FOURTH_DIMENSION", "4th Dimension"),
                            ("OTHER", "Other"),
                        ],
                        default="SITDOWN",
                        max_length=20,
                    ),
                ),
                (
                    "max_drop_height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "launch_type",
                    models.CharField(
                        choices=[
                            ("CHAIN", "Chain Lift"),
                            ("LSM", "LSM Launch"),
                            ("HYDRAULIC", "Hydraulic Launch"),
                            ("GRAVITY", "Gravity"),
                            ("OTHER", "Other"),
                        ],
                        default="CHAIN",
                        max_length=20,
                    ),
                ),
                ("train_style", models.CharField(blank=True, max_length=255)),
                ("trains_count", models.PositiveIntegerField(blank=True, null=True)),
                ("cars_per_train", models.PositiveIntegerField(blank=True, null=True)),
                ("seats_per_car", models.PositiveIntegerField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ride",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_rideevent" ("average_rating", "capacity_per_hour", "category", "closing_date", "created_at", "description", "designer_id", "id", "manufacturer_id", "max_height_in", "min_height_in", "name", "opening_date", "park_area_id", "park_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "post_closing_status", "ride_duration_seconds", "ride_model_id", "slug", "status", "status_since", "updated_at") VALUES (NEW."average_rating", NEW."capacity_per_hour", NEW."category", NEW."closing_date", NEW."created_at", NEW."description", NEW."designer_id", NEW."id", NEW."manufacturer_id", NEW."max_height_in", NEW."min_height_in", NEW."name", NEW."opening_date", NEW."park_area_id", NEW."park_id", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."post_closing_status", NEW."ride_duration_seconds", NEW."ride_model_id", NEW."slug", NEW."status", NEW."status_since", NEW."updated_at"); RETURN NULL;',
                    hash="870aa867ae6892f187dc0382e4a6833b5d1267c5",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_52074",
                    table="rides_ride",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ride",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_rideevent" ("average_rating", "capacity_per_hour", "category", "closing_date", "created_at", "description", "designer_id", "id", "manufacturer_id", "max_height_in", "min_height_in", "name", "opening_date", "park_area_id", "park_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "post_closing_status", "ride_duration_seconds", "ride_model_id", "slug", "status", "status_since", "updated_at") VALUES (NEW."average_rating", NEW."capacity_per_hour", NEW."category", NEW."closing_date", NEW."created_at", NEW."description", NEW."designer_id", NEW."id", NEW."manufacturer_id", NEW."max_height_in", NEW."min_height_in", NEW."name", NEW."opening_date", NEW."park_area_id", NEW."park_id", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."post_closing_status", NEW."ride_duration_seconds", NEW."ride_model_id", NEW."slug", NEW."status", NEW."status_since", NEW."updated_at"); RETURN NULL;',
                    hash="8bafb42256ee98b4517ae4d39d0e774111794fea",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_4917a",
                    table="rides_ride",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodel",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridemodelevent" ("category", "created_at", "description", "id", "manufacturer_id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."manufacturer_id", NEW."name", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."updated_at"); RETURN NULL;',
                    hash="e9e3c3ec4cb2400b363035534c580c94a3bb1d53",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_0aaee",
                    table="rides_ridemodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodel",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridemodelevent" ("category", "created_at", "description", "id", "manufacturer_id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."manufacturer_id", NEW."name", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."updated_at"); RETURN NULL;',
                    hash="4c8073b866beac402ace852e23974fcb01d24267",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_0ca1a",
                    table="rides_ridemodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="rollercoasterstats",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_rollercoasterstatsevent" ("cars_per_train", "height_ft", "id", "inversions", "launch_type", "length_ft", "max_drop_height_ft", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "ride_time_seconds", "roller_coaster_type", "seats_per_car", "speed_mph", "track_material", "track_type", "train_style", "trains_count") VALUES (NEW."cars_per_train", NEW."height_ft", NEW."id", NEW."inversions", NEW."launch_type", NEW."length_ft", NEW."max_drop_height_ft", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."ride_id", NEW."ride_time_seconds", NEW."roller_coaster_type", NEW."seats_per_car", NEW."speed_mph", NEW."track_material", NEW."track_type", NEW."train_style", NEW."trains_count"); RETURN NULL;',
                    hash="529f2cf3bb62b57c85123143523475c1999099ec",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_96f8b",
                    table="rides_rollercoasterstats",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="rollercoasterstats",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_rollercoasterstatsevent" ("cars_per_train", "height_ft", "id", "inversions", "launch_type", "length_ft", "max_drop_height_ft", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "ride_time_seconds", "roller_coaster_type", "seats_per_car", "speed_mph", "track_material", "track_type", "train_style", "trains_count") VALUES (NEW."cars_per_train", NEW."height_ft", NEW."id", NEW."inversions", NEW."launch_type", NEW."length_ft", NEW."max_drop_height_ft", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."ride_id", NEW."ride_time_seconds", NEW."roller_coaster_type", NEW."seats_per_car", NEW."speed_mph", NEW."track_material", NEW."track_type", NEW."train_style", NEW."trains_count"); RETURN NULL;',
                    hash="3c9d3cb53ac46a2f4b2a27a63c5ed17a18de9827",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_24e8a",
                    table="rides_rollercoasterstats",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="designer",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                limit_choices_to={"roles__contains": ["DESIGNER"]},
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.company",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="manufacturer",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                limit_choices_to={"roles__contains": ["MANUFACTURER"]},
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.company",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="park",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="parks.park",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="park_area",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="parks.parkarea",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ride",
            ),
        ),
        migrations.AddField(
            model_name="rideevent",
            name="ride_model",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                help_text="The specific model/type of this ride",
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="manufacturer",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                limit_choices_to={"roles__contains": ["MANUFACTURER"]},
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.company",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="rollercoasterstatsevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="rollercoasterstatsevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.rollercoasterstats",
            ),
        ),
        migrations.AddField(
            model_name="rollercoasterstatsevent",
            name="ride",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ride",
            ),
        ),
    ]
