# Generated by Django 5.2.5 on 2025-08-28 19:09

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


class Migration(migrations.Migration):

    dependencies = [
        ("pghistory", "0006_delete_aggregateevent"),
        ("rides", "0009_add_banner_card_image_fields"),
    ]

    operations = [
        migrations.CreateModel(
            name="RideModelPhoto",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "image",
                    models.ImageField(
                        help_text="Photo of the ride model",
                        upload_to="ride_models/photos/",
                    ),
                ),
                ("caption", models.CharField(blank=True, max_length=500)),
                ("alt_text", models.CharField(blank=True, max_length=255)),
                (
                    "photo_type",
                    models.CharField(
                        choices=[
                            ("PROMOTIONAL", "Promotional"),
                            ("TECHNICAL", "Technical Drawing"),
                            ("INSTALLATION", "Installation Example"),
                            ("RENDERING", "3D Rendering"),
                            ("CATALOG", "Catalog Image"),
                        ],
                        default="PROMOTIONAL",
                        max_length=20,
                    ),
                ),
                (
                    "is_primary",
                    models.BooleanField(
                        default=False,
                        help_text="Whether this is the primary photo for the ride model",
                    ),
                ),
                ("photographer", models.CharField(blank=True, max_length=255)),
                ("source", models.CharField(blank=True, max_length=255)),
                ("copyright_info", models.CharField(blank=True, max_length=255)),
            ],
            options={
                "ordering": ["-is_primary", "-created_at"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelPhotoEvent",
            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)),
                (
                    "image",
                    models.ImageField(
                        help_text="Photo of the ride model",
                        upload_to="ride_models/photos/",
                    ),
                ),
                ("caption", models.CharField(blank=True, max_length=500)),
                ("alt_text", models.CharField(blank=True, max_length=255)),
                (
                    "photo_type",
                    models.CharField(
                        choices=[
                            ("PROMOTIONAL", "Promotional"),
                            ("TECHNICAL", "Technical Drawing"),
                            ("INSTALLATION", "Installation Example"),
                            ("RENDERING", "3D Rendering"),
                            ("CATALOG", "Catalog Image"),
                        ],
                        default="PROMOTIONAL",
                        max_length=20,
                    ),
                ),
                (
                    "is_primary",
                    models.BooleanField(
                        default=False,
                        help_text="Whether this is the primary photo for the ride model",
                    ),
                ),
                ("photographer", models.CharField(blank=True, max_length=255)),
                ("source", models.CharField(blank=True, max_length=255)),
                ("copyright_info", models.CharField(blank=True, max_length=255)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelTechnicalSpec",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "spec_category",
                    models.CharField(
                        choices=[
                            ("DIMENSIONS", "Dimensions"),
                            ("PERFORMANCE", "Performance"),
                            ("CAPACITY", "Capacity"),
                            ("SAFETY", "Safety Features"),
                            ("ELECTRICAL", "Electrical Requirements"),
                            ("FOUNDATION", "Foundation Requirements"),
                            ("MAINTENANCE", "Maintenance"),
                            ("OTHER", "Other"),
                        ],
                        max_length=50,
                    ),
                ),
                (
                    "spec_name",
                    models.CharField(help_text="Name of the specification", max_length=100),
                ),
                (
                    "spec_value",
                    models.CharField(help_text="Value of the specification", max_length=255),
                ),
                (
                    "spec_unit",
                    models.CharField(blank=True, help_text="Unit of measurement", max_length=20),
                ),
                (
                    "notes",
                    models.TextField(
                        blank=True,
                        help_text="Additional notes about this specification",
                    ),
                ),
            ],
            options={
                "ordering": ["spec_category", "spec_name"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelTechnicalSpecEvent",
            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)),
                (
                    "spec_category",
                    models.CharField(
                        choices=[
                            ("DIMENSIONS", "Dimensions"),
                            ("PERFORMANCE", "Performance"),
                            ("CAPACITY", "Capacity"),
                            ("SAFETY", "Safety Features"),
                            ("ELECTRICAL", "Electrical Requirements"),
                            ("FOUNDATION", "Foundation Requirements"),
                            ("MAINTENANCE", "Maintenance"),
                            ("OTHER", "Other"),
                        ],
                        max_length=50,
                    ),
                ),
                (
                    "spec_name",
                    models.CharField(help_text="Name of the specification", max_length=100),
                ),
                (
                    "spec_value",
                    models.CharField(help_text="Value of the specification", max_length=255),
                ),
                (
                    "spec_unit",
                    models.CharField(blank=True, help_text="Unit of measurement", max_length=20),
                ),
                (
                    "notes",
                    models.TextField(
                        blank=True,
                        help_text="Additional notes about this specification",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelVariant",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "name",
                    models.CharField(help_text="Name of this variant", max_length=255),
                ),
                (
                    "description",
                    models.TextField(blank=True, help_text="Description of variant differences"),
                ),
                (
                    "min_height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "max_height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "min_speed_mph",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
                ),
                (
                    "max_speed_mph",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
                ),
                (
                    "distinguishing_features",
                    models.TextField(
                        blank=True,
                        help_text="What makes this variant unique from the base model",
                    ),
                ),
            ],
            options={
                "ordering": ["ride_model", "name"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="RideModelVariantEvent",
            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(help_text="Name of this variant", max_length=255),
                ),
                (
                    "description",
                    models.TextField(blank=True, help_text="Description of variant differences"),
                ),
                (
                    "min_height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "max_height_ft",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True),
                ),
                (
                    "min_speed_mph",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
                ),
                (
                    "max_speed_mph",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
                ),
                (
                    "distinguishing_features",
                    models.TextField(
                        blank=True,
                        help_text="What makes this variant unique from the base model",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AlterModelOptions(
            name="ridemodel",
            options={"ordering": ["manufacturer__name", "name"]},
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ridemodel",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ridemodel",
            name="update_update",
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="first_installation_year",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Year of first installation of this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="is_discontinued",
            field=models.BooleanField(
                default=False,
                help_text="Whether this model is no longer being manufactured",
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="last_installation_year",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Year of last installation of this model (if discontinued)",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="meta_description",
            field=models.CharField(
                blank=True,
                help_text="SEO meta description (auto-generated if blank)",
                max_length=160,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="meta_title",
            field=models.CharField(
                blank=True,
                help_text="SEO meta title (auto-generated if blank)",
                max_length=60,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="notable_features",
            field=models.TextField(
                blank=True,
                help_text="Notable design features or innovations (JSON or comma-separated)",
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="restraint_system",
            field=models.CharField(
                blank=True,
                help_text="Type of restraint system (e.g., over-shoulder, lap bar, vest)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="slug",
            field=models.SlugField(
                default=django.utils.timezone.now,
                help_text="URL-friendly identifier",
                max_length=255,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="support_structure",
            field=models.CharField(
                blank=True,
                help_text="Type of support structure (e.g., steel, wooden, hybrid)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="target_market",
            field=models.CharField(
                blank=True,
                choices=[
                    ("FAMILY", "Family"),
                    ("THRILL", "Thrill"),
                    ("EXTREME", "Extreme"),
                    ("KIDDIE", "Kiddie"),
                    ("ALL_AGES", "All Ages"),
                ],
                help_text="Primary target market for this ride model",
                max_length=50,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="total_installations",
            field=models.PositiveIntegerField(
                default=0,
                help_text="Total number of installations worldwide (auto-calculated)",
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="track_type",
            field=models.CharField(
                blank=True,
                help_text="Type of track system (e.g., tubular steel, I-Box, wooden)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="train_configuration",
            field=models.CharField(
                blank=True,
                help_text="Typical train configuration (e.g., 2 trains, 7 cars per train, 4 seats per car)",
                max_length=200,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_capacity_range_max",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Maximum typical hourly capacity for this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_capacity_range_min",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Minimum typical hourly capacity for this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_height_range_max_ft",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Maximum typical height in feet for this model",
                max_digits=6,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_height_range_min_ft",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Minimum typical height in feet for this model",
                max_digits=6,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_speed_range_max_mph",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Maximum typical speed in mph for this model",
                max_digits=5,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="typical_speed_range_min_mph",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Minimum typical speed in mph for this model",
                max_digits=5,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="first_installation_year",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Year of first installation of this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="is_discontinued",
            field=models.BooleanField(
                default=False,
                help_text="Whether this model is no longer being manufactured",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="last_installation_year",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Year of last installation of this model (if discontinued)",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="meta_description",
            field=models.CharField(
                blank=True,
                help_text="SEO meta description (auto-generated if blank)",
                max_length=160,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="meta_title",
            field=models.CharField(
                blank=True,
                help_text="SEO meta title (auto-generated if blank)",
                max_length=60,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="notable_features",
            field=models.TextField(
                blank=True,
                help_text="Notable design features or innovations (JSON or comma-separated)",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="restraint_system",
            field=models.CharField(
                blank=True,
                help_text="Type of restraint system (e.g., over-shoulder, lap bar, vest)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="slug",
            field=models.SlugField(
                db_index=False,
                default=django.utils.timezone.now,
                help_text="URL-friendly identifier",
                max_length=255,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="support_structure",
            field=models.CharField(
                blank=True,
                help_text="Type of support structure (e.g., steel, wooden, hybrid)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="target_market",
            field=models.CharField(
                blank=True,
                choices=[
                    ("FAMILY", "Family"),
                    ("THRILL", "Thrill"),
                    ("EXTREME", "Extreme"),
                    ("KIDDIE", "Kiddie"),
                    ("ALL_AGES", "All Ages"),
                ],
                help_text="Primary target market for this ride model",
                max_length=50,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="total_installations",
            field=models.PositiveIntegerField(
                default=0,
                help_text="Total number of installations worldwide (auto-calculated)",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="track_type",
            field=models.CharField(
                blank=True,
                help_text="Type of track system (e.g., tubular steel, I-Box, wooden)",
                max_length=100,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="train_configuration",
            field=models.CharField(
                blank=True,
                help_text="Typical train configuration (e.g., 2 trains, 7 cars per train, 4 seats per car)",
                max_length=200,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_capacity_range_max",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Maximum typical hourly capacity for this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_capacity_range_min",
            field=models.PositiveIntegerField(
                blank=True,
                help_text="Minimum typical hourly capacity for this model",
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_height_range_max_ft",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Maximum typical height in feet for this model",
                max_digits=6,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_height_range_min_ft",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Minimum typical height in feet for this model",
                max_digits=6,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_speed_range_max_mph",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Maximum typical speed in mph for this model",
                max_digits=5,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="typical_speed_range_min_mph",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Minimum typical speed in mph for this model",
                max_digits=5,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="ridemodel",
            name="category",
            field=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="",
                help_text="Primary category classification",
                max_length=2,
            ),
        ),
        migrations.AlterField(
            model_name="ridemodel",
            name="description",
            field=models.TextField(blank=True, help_text="Detailed description of the ride model"),
        ),
        migrations.AlterField(
            model_name="ridemodel",
            name="manufacturer",
            field=models.ForeignKey(
                blank=True,
                help_text="Primary manufacturer of this ride model",
                limit_choices_to={"roles__contains": ["MANUFACTURER"]},
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="ride_models",
                to="rides.company",
            ),
        ),
        migrations.AlterField(
            model_name="ridemodel",
            name="name",
            field=models.CharField(help_text="Name of the ride model", max_length=255),
        ),
        migrations.AlterField(
            model_name="ridemodelevent",
            name="category",
            field=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="",
                help_text="Primary category classification",
                max_length=2,
            ),
        ),
        migrations.AlterField(
            model_name="ridemodelevent",
            name="description",
            field=models.TextField(blank=True, help_text="Detailed description of the ride model"),
        ),
        migrations.AlterField(
            model_name="ridemodelevent",
            name="manufacturer",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                help_text="Primary manufacturer of this ride model",
                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.AlterField(
            model_name="ridemodelevent",
            name="name",
            field=models.CharField(help_text="Name of the ride model", max_length=255),
        ),
        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", "first_installation_year", "id", "is_discontinued", "last_installation_year", "manufacturer_id", "meta_description", "meta_title", "name", "notable_features", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "primary_image_id", "restraint_system", "slug", "support_structure", "target_market", "total_installations", "track_type", "train_configuration", "typical_capacity_range_max", "typical_capacity_range_min", "typical_height_range_max_ft", "typical_height_range_min_ft", "typical_speed_range_max_mph", "typical_speed_range_min_mph", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."first_installation_year", NEW."id", NEW."is_discontinued", NEW."last_installation_year", NEW."manufacturer_id", NEW."meta_description", NEW."meta_title", NEW."name", NEW."notable_features", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."primary_image_id", NEW."restraint_system", NEW."slug", NEW."support_structure", NEW."target_market", NEW."total_installations", NEW."track_type", NEW."train_configuration", NEW."typical_capacity_range_max", NEW."typical_capacity_range_min", NEW."typical_height_range_max_ft", NEW."typical_height_range_min_ft", NEW."typical_speed_range_max_mph", NEW."typical_speed_range_min_mph", NEW."updated_at"); RETURN NULL;',
                    hash="d137099a9278ee22e474aaa33477a36d8eb73081",
                    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", "first_installation_year", "id", "is_discontinued", "last_installation_year", "manufacturer_id", "meta_description", "meta_title", "name", "notable_features", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "primary_image_id", "restraint_system", "slug", "support_structure", "target_market", "total_installations", "track_type", "train_configuration", "typical_capacity_range_max", "typical_capacity_range_min", "typical_height_range_max_ft", "typical_height_range_min_ft", "typical_speed_range_max_mph", "typical_speed_range_min_mph", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."first_installation_year", NEW."id", NEW."is_discontinued", NEW."last_installation_year", NEW."manufacturer_id", NEW."meta_description", NEW."meta_title", NEW."name", NEW."notable_features", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."primary_image_id", NEW."restraint_system", NEW."slug", NEW."support_structure", NEW."target_market", NEW."total_installations", NEW."track_type", NEW."train_configuration", NEW."typical_capacity_range_max", NEW."typical_capacity_range_min", NEW."typical_height_range_max_ft", NEW."typical_height_range_min_ft", NEW."typical_speed_range_max_mph", NEW."typical_speed_range_min_mph", NEW."updated_at"); RETURN NULL;',
                    hash="b585786e003aed21da9e031f7f00145fbfa61471",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_0ca1a",
                    table="rides_ridemodel",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AddField(
            model_name="ridemodelphoto",
            name="ride_model",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="photos",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodel",
            name="primary_image",
            field=models.ForeignKey(
                blank=True,
                help_text="Primary promotional image for this ride model",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="ride_models_as_primary",
                to="rides.ridemodelphoto",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelevent",
            name="primary_image",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                help_text="Primary promotional image for this ride model",
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ridemodelphoto",
            ),
        ),
        migrations.AddConstraint(
            model_name="ridemodel",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("typical_height_range_min_ft__isnull", True),
                    ("typical_height_range_max_ft__isnull", True),
                    (
                        "typical_height_range_min_ft__lte",
                        models.F("typical_height_range_max_ft"),
                    ),
                    _connector="OR",
                ),
                name="ride_model_height_range_logical",
                violation_error_message="Minimum height cannot exceed maximum height",
            ),
        ),
        migrations.AddConstraint(
            model_name="ridemodel",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("typical_speed_range_min_mph__isnull", True),
                    ("typical_speed_range_max_mph__isnull", True),
                    (
                        "typical_speed_range_min_mph__lte",
                        models.F("typical_speed_range_max_mph"),
                    ),
                    _connector="OR",
                ),
                name="ride_model_speed_range_logical",
                violation_error_message="Minimum speed cannot exceed maximum speed",
            ),
        ),
        migrations.AddConstraint(
            model_name="ridemodel",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("typical_capacity_range_min__isnull", True),
                    ("typical_capacity_range_max__isnull", True),
                    (
                        "typical_capacity_range_min__lte",
                        models.F("typical_capacity_range_max"),
                    ),
                    _connector="OR",
                ),
                name="ride_model_capacity_range_logical",
                violation_error_message="Minimum capacity cannot exceed maximum capacity",
            ),
        ),
        migrations.AddConstraint(
            model_name="ridemodel",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("first_installation_year__isnull", True),
                    ("last_installation_year__isnull", True),
                    (
                        "first_installation_year__lte",
                        models.F("last_installation_year"),
                    ),
                    _connector="OR",
                ),
                name="ride_model_installation_years_logical",
                violation_error_message="First installation year cannot be after last installation year",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelphotoevent",
            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="ridemodelphotoevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ridemodelphoto",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelphotoevent",
            name="ride_model",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodeltechnicalspec",
            name="ride_model",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="technical_specs",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodeltechnicalspecevent",
            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="ridemodeltechnicalspecevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ridemodeltechnicalspec",
            ),
        ),
        migrations.AddField(
            model_name="ridemodeltechnicalspecevent",
            name="ride_model",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelvariant",
            name="ride_model",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="variants",
                to="rides.ridemodel",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelvariantevent",
            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="ridemodelvariantevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ridemodelvariant",
            ),
        ),
        migrations.AddField(
            model_name="ridemodelvariantevent",
            name="ride_model",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ridemodel",
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodelphoto",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridemodelphotoevent" ("alt_text", "caption", "copyright_info", "created_at", "id", "image", "is_primary", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "photo_type", "photographer", "ride_model_id", "source", "updated_at") VALUES (NEW."alt_text", NEW."caption", NEW."copyright_info", NEW."created_at", NEW."id", NEW."image", NEW."is_primary", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."photo_type", NEW."photographer", NEW."ride_model_id", NEW."source", NEW."updated_at"); RETURN NULL;',
                    hash="729b234e2873081913157bc703214b178207cb43",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_c5e58",
                    table="rides_ridemodelphoto",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodelphoto",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridemodelphotoevent" ("alt_text", "caption", "copyright_info", "created_at", "id", "image", "is_primary", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "photo_type", "photographer", "ride_model_id", "source", "updated_at") VALUES (NEW."alt_text", NEW."caption", NEW."copyright_info", NEW."created_at", NEW."id", NEW."image", NEW."is_primary", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."photo_type", NEW."photographer", NEW."ride_model_id", NEW."source", NEW."updated_at"); RETURN NULL;',
                    hash="663f5c7d7af9ae9e00f28077e3c3fd8050f9fcf8",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_3afcd",
                    table="rides_ridemodelphoto",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AlterUniqueTogether(
            name="ridemodeltechnicalspec",
            unique_together={("ride_model", "spec_category", "spec_name")},
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodeltechnicalspec",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridemodeltechnicalspecevent" ("created_at", "id", "notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_model_id", "spec_category", "spec_name", "spec_unit", "spec_value", "updated_at") VALUES (NEW."created_at", NEW."id", NEW."notes", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."ride_model_id", NEW."spec_category", NEW."spec_name", NEW."spec_unit", NEW."spec_value", NEW."updated_at"); RETURN NULL;',
                    hash="c69e4b67f99f3c6135baa3b1f90005dd1a28fc99",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_08870",
                    table="rides_ridemodeltechnicalspec",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodeltechnicalspec",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridemodeltechnicalspecevent" ("created_at", "id", "notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_model_id", "spec_category", "spec_name", "spec_unit", "spec_value", "updated_at") VALUES (NEW."created_at", NEW."id", NEW."notes", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."ride_model_id", NEW."spec_category", NEW."spec_name", NEW."spec_unit", NEW."spec_value", NEW."updated_at"); RETURN NULL;',
                    hash="9c6cdcf25f220fe155970cde66cc79e98ad44142",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_73620",
                    table="rides_ridemodeltechnicalspec",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AlterUniqueTogether(
            name="ridemodelvariant",
            unique_together={("ride_model", "name")},
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodelvariant",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridemodelvariantevent" ("created_at", "description", "distinguishing_features", "id", "max_height_ft", "max_speed_mph", "min_height_ft", "min_speed_mph", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_model_id", "updated_at") VALUES (NEW."created_at", NEW."description", NEW."distinguishing_features", NEW."id", NEW."max_height_ft", NEW."max_speed_mph", NEW."min_height_ft", NEW."min_speed_mph", NEW."name", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."ride_model_id", NEW."updated_at"); RETURN NULL;',
                    hash="89d68cdcd08787e00dd8d1f25e9229eb02528f26",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_1cb69",
                    table="rides_ridemodelvariant",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridemodelvariant",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridemodelvariantevent" ("created_at", "description", "distinguishing_features", "id", "max_height_ft", "max_speed_mph", "min_height_ft", "min_speed_mph", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_model_id", "updated_at") VALUES (NEW."created_at", NEW."description", NEW."distinguishing_features", NEW."id", NEW."max_height_ft", NEW."max_speed_mph", NEW."min_height_ft", NEW."min_speed_mph", NEW."name", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."ride_model_id", NEW."updated_at"); RETURN NULL;',
                    hash="cc7f0da0cef685e4504f8cad28af9b296ed8a2aa",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_f7599",
                    table="rides_ridemodelvariant",
                    when="AFTER",
                ),
            ),
        ),
    ]
