# Generated by Django 5.2.5 on 2025-09-17 01:25

import pgtrigger.compiler
import pgtrigger.migrations
from django.db import migrations

import apps.core.choices.fields


class Migration(migrations.Migration):

    dependencies = [
        ("rides", "0023_alter_ridemodelphoto_photo_type_and_more"),
    ]

    operations = [
        pgtrigger.migrations.RemoveTrigger(
            model_name="rollercoasterstats",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="rollercoasterstats",
            name="update_update",
        ),
        migrations.RemoveField(
            model_name="rollercoasterstats",
            name="launch_type",
        ),
        migrations.RemoveField(
            model_name="rollercoasterstatsevent",
            name="launch_type",
        ),
        migrations.AddField(
            model_name="rollercoasterstats",
            name="propulsion_system",
            field=apps.core.choices.fields.RichChoiceField(
                allow_deprecated=False,
                choice_group="propulsion_systems",
                choices=[
                    ("CHAIN", "Chain Lift"),
                    ("LSM", "LSM Launch"),
                    ("HYDRAULIC", "Hydraulic Launch"),
                    ("GRAVITY", "Gravity"),
                    ("OTHER", "Other"),
                ],
                default="CHAIN",
                domain="rides",
                help_text="Propulsion or lift system type",
                max_length=20,
            ),
        ),
        migrations.AddField(
            model_name="rollercoasterstatsevent",
            name="propulsion_system",
            field=apps.core.choices.fields.RichChoiceField(
                allow_deprecated=False,
                choice_group="propulsion_systems",
                choices=[
                    ("CHAIN", "Chain Lift"),
                    ("LSM", "LSM Launch"),
                    ("HYDRAULIC", "Hydraulic Launch"),
                    ("GRAVITY", "Gravity"),
                    ("OTHER", "Other"),
                ],
                default="CHAIN",
                domain="rides",
                help_text="Propulsion or lift system type",
                max_length=20,
            ),
        ),
        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", "length_ft", "max_drop_height_ft", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "propulsion_system", "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."length_ft", NEW."max_drop_height_ft", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."propulsion_system", 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="89e2bb56c0befa025a9961f8df34a8a02c09f188",
                    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", "length_ft", "max_drop_height_ft", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "propulsion_system", "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."length_ft", NEW."max_drop_height_ft", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."propulsion_system", 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="047cc99ae3282202b6dc43c8dbe07690076d5068",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_24e8a",
                    table="rides_rollercoasterstats",
                    when="AFTER",
                ),
            ),
        ),
    ]
