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

import django.contrib.gis.db.models.fields
import django.db.models.deletion
import pgtrigger.compiler
import pgtrigger.migrations
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("pghistory", "0006_delete_aggregateevent"),
        ("rides", "0004_rideevent_ridemodelevent_rollercoasterstatsevent_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="RideLocationEvent",
            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()),
                (
                    "point",
                    django.contrib.gis.db.models.fields.PointField(
                        blank=True,
                        help_text="Geographic coordinates for ride location (longitude, latitude)",
                        null=True,
                        srid=4326,
                    ),
                ),
                (
                    "park_area",
                    models.CharField(
                        blank=True,
                        help_text="Themed area or land within the park (e.g., 'Frontierland', 'Tomorrowland')",
                        max_length=100,
                    ),
                ),
                (
                    "notes",
                    models.TextField(blank=True, help_text="General location notes"),
                ),
                (
                    "entrance_notes",
                    models.TextField(
                        blank=True,
                        help_text="Directions to ride entrance, queue location, or navigation tips",
                    ),
                ),
                (
                    "accessibility_notes",
                    models.TextField(
                        blank=True,
                        help_text="Information about accessible entrances, wheelchair access, etc.",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridelocation",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridelocationevent" ("accessibility_notes", "created_at", "entrance_notes", "id", "notes", "park_area", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "point", "ride_id", "updated_at") VALUES (NEW."accessibility_notes", NEW."created_at", NEW."entrance_notes", NEW."id", NEW."notes", NEW."park_area", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."point", NEW."ride_id", NEW."updated_at"); RETURN NULL;',
                    hash="04c4c3aa17d4ef852d52b40d1dba4cd7372d5e29",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_b66c2",
                    table="rides_ridelocation",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridelocation",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridelocationevent" ("accessibility_notes", "created_at", "entrance_notes", "id", "notes", "park_area", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "point", "ride_id", "updated_at") VALUES (NEW."accessibility_notes", NEW."created_at", NEW."entrance_notes", NEW."id", NEW."notes", NEW."park_area", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."point", NEW."ride_id", NEW."updated_at"); RETURN NULL;',
                    hash="7073b4517d00b884b2f3fddf89caeefaa64058ad",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_402ba",
                    table="rides_ridelocation",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AddField(
            model_name="ridelocationevent",
            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="ridelocationevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.ridelocation",
            ),
        ),
        migrations.AddField(
            model_name="ridelocationevent",
            name="ride",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ride",
            ),
        ),
    ]
