# Generated by Django 5.2.5 on 2025-08-31 01:46

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


class Migration(migrations.Migration):

    dependencies = [
        ("parks", "0012_remove_parkphoto_insert_insert_and_more"),
    ]

    operations = [
        pgtrigger.migrations.RemoveTrigger(
            model_name="park",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="park",
            name="update_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="parklocation",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="parklocation",
            name="update_update",
        ),
        migrations.AddField(
            model_name="park",
            name="park_type",
            field=models.CharField(
                choices=[
                    ("THEME_PARK", "Theme Park"),
                    ("AMUSEMENT_PARK", "Amusement Park"),
                    ("WATER_PARK", "Water Park"),
                    ("FAMILY_ENTERTAINMENT_CENTER", "Family Entertainment Center"),
                    ("CARNIVAL", "Carnival"),
                    ("FAIR", "Fair"),
                    ("PIER", "Pier"),
                    ("BOARDWALK", "Boardwalk"),
                    ("SAFARI_PARK", "Safari Park"),
                    ("ZOO", "Zoo"),
                    ("OTHER", "Other"),
                ],
                db_index=True,
                default="THEME_PARK",
                help_text="Type/category of the park",
                max_length=30,
            ),
        ),
        migrations.AddField(
            model_name="parkevent",
            name="park_type",
            field=models.CharField(
                choices=[
                    ("THEME_PARK", "Theme Park"),
                    ("AMUSEMENT_PARK", "Amusement Park"),
                    ("WATER_PARK", "Water Park"),
                    ("FAMILY_ENTERTAINMENT_CENTER", "Family Entertainment Center"),
                    ("CARNIVAL", "Carnival"),
                    ("FAIR", "Fair"),
                    ("PIER", "Pier"),
                    ("BOARDWALK", "Boardwalk"),
                    ("SAFARI_PARK", "Safari Park"),
                    ("ZOO", "Zoo"),
                    ("OTHER", "Other"),
                ],
                default="THEME_PARK",
                help_text="Type/category of the park",
                max_length=30,
            ),
        ),
        migrations.AddField(
            model_name="parklocation",
            name="continent",
            field=models.CharField(
                blank=True,
                db_index=True,
                help_text="Continent where the park is located",
                max_length=50,
            ),
        ),
        migrations.AddField(
            model_name="parklocationevent",
            name="continent",
            field=models.CharField(
                blank=True,
                help_text="Continent where the park is located",
                max_length=50,
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="park",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "parks_parkevent" ("average_rating", "banner_image_id", "card_image_id", "closing_date", "coaster_count", "created_at", "description", "id", "name", "opening_date", "operating_season", "operator_id", "park_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "property_owner_id", "ride_count", "size_acres", "slug", "status", "updated_at", "url", "website") VALUES (NEW."average_rating", NEW."banner_image_id", NEW."card_image_id", NEW."closing_date", NEW."coaster_count", NEW."created_at", NEW."description", NEW."id", NEW."name", NEW."opening_date", NEW."operating_season", NEW."operator_id", NEW."park_type", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."property_owner_id", NEW."ride_count", NEW."size_acres", NEW."slug", NEW."status", NEW."updated_at", NEW."url", NEW."website"); RETURN NULL;',
                    hash="406615e99a0bd58eadc2ad3023c988364c61f65a",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_66883",
                    table="parks_park",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="park",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "parks_parkevent" ("average_rating", "banner_image_id", "card_image_id", "closing_date", "coaster_count", "created_at", "description", "id", "name", "opening_date", "operating_season", "operator_id", "park_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "property_owner_id", "ride_count", "size_acres", "slug", "status", "updated_at", "url", "website") VALUES (NEW."average_rating", NEW."banner_image_id", NEW."card_image_id", NEW."closing_date", NEW."coaster_count", NEW."created_at", NEW."description", NEW."id", NEW."name", NEW."opening_date", NEW."operating_season", NEW."operator_id", NEW."park_type", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."property_owner_id", NEW."ride_count", NEW."size_acres", NEW."slug", NEW."status", NEW."updated_at", NEW."url", NEW."website"); RETURN NULL;',
                    hash="ca8b337b9b1f1a937a4dd88cde8b31231d0fdff5",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_19f56",
                    table="parks_park",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="parklocation",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "parks_parklocationevent" ("best_arrival_time", "city", "continent", "country", "highway_exit", "id", "osm_id", "osm_type", "park_id", "parking_notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "point", "postal_code", "seasonal_notes", "state", "street_address") VALUES (NEW."best_arrival_time", NEW."city", NEW."continent", NEW."country", NEW."highway_exit", NEW."id", NEW."osm_id", NEW."osm_type", NEW."park_id", NEW."parking_notes", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."point", NEW."postal_code", NEW."seasonal_notes", NEW."state", NEW."street_address"); RETURN NULL;',
                    hash="aecd083c917cea3170e944c73c4906a78eccd676",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_f8c53",
                    table="parks_parklocation",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="parklocation",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "parks_parklocationevent" ("best_arrival_time", "city", "continent", "country", "highway_exit", "id", "osm_id", "osm_type", "park_id", "parking_notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "point", "postal_code", "seasonal_notes", "state", "street_address") VALUES (NEW."best_arrival_time", NEW."city", NEW."continent", NEW."country", NEW."highway_exit", NEW."id", NEW."osm_id", NEW."osm_type", NEW."park_id", NEW."parking_notes", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."point", NEW."postal_code", NEW."seasonal_notes", NEW."state", NEW."street_address"); RETURN NULL;',
                    hash="a70bc26b34235fe4342009d491d80b990ee3ed7e",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_6dd0d",
                    table="parks_parklocation",
                    when="AFTER",
                ),
            ),
        ),
    ]
