# Generated by Django 5.2.5 on 2025-08-28 18:35

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


class Migration(migrations.Migration):

    dependencies = [
        ("parks", "0008_parkphoto_parkphotoevent_and_more"),
    ]

    operations = [
        pgtrigger.migrations.RemoveTrigger(
            model_name="park",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="park",
            name="update_update",
        ),
        migrations.AddField(
            model_name="park",
            name="banner_image",
            field=models.ForeignKey(
                blank=True,
                help_text="Photo to use as banner image for this park",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="parks_using_as_banner",
                to="parks.parkphoto",
            ),
        ),
        migrations.AddField(
            model_name="park",
            name="card_image",
            field=models.ForeignKey(
                blank=True,
                help_text="Photo to use as card image for this park",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="parks_using_as_card",
                to="parks.parkphoto",
            ),
        ),
        migrations.AddField(
            model_name="parkevent",
            name="banner_image",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                help_text="Photo to use as banner image for this park",
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="parks.parkphoto",
            ),
        ),
        migrations.AddField(
            model_name="parkevent",
            name="card_image",
            field=models.ForeignKey(
                blank=True,
                db_constraint=False,
                help_text="Photo to use as card image for this park",
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="parks.parkphoto",
            ),
        ),
        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", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "property_owner_id", "ride_count", "size_acres", "slug", "status", "updated_at", "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", _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."website"); RETURN NULL;',
                    hash="291a6e8efb89a33ee43bff05f44598a7814a05f0",
                    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", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "property_owner_id", "ride_count", "size_acres", "slug", "status", "updated_at", "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", _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."website"); RETURN NULL;',
                    hash="a689acf5a74ebd3aa7ad333881edb99778185da2",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_19f56",
                    table="parks_park",
                    when="AFTER",
                ),
            ),
        ),
    ]
