# Generated by Django 5.2.9 on 2026-01-02 02:30

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


class Migration(migrations.Migration):

    dependencies = [
        ("parks", "0027_add_company_entity_fields"),
    ]

    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="closing_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
                default="DAY",
                help_text="Precision of the closing date",
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name="park",
            name="opening_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
                default="DAY",
                help_text="Precision of the opening date (YEAR for circa dates)",
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name="parkevent",
            name="closing_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
                default="DAY",
                help_text="Precision of the closing date",
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name="parkevent",
            name="opening_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year"), ("MONTH", "Month"), ("DAY", "Day")],
                default="DAY",
                help_text="Precision of the opening date (YEAR for circa dates)",
                max_length=10,
            ),
        ),
        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", "closing_date_precision", "coaster_count", "created_at", "description", "email", "id", "name", "opening_date", "opening_date_precision", "opening_year", "operating_season", "operator_id", "park_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "phone", "property_owner_id", "ride_count", "search_text", "size_acres", "slug", "status", "timezone", "updated_at", "url", "website") VALUES (NEW."average_rating", NEW."banner_image_id", NEW."card_image_id", NEW."closing_date", NEW."closing_date_precision", NEW."coaster_count", NEW."created_at", NEW."description", NEW."email", NEW."id", NEW."name", NEW."opening_date", NEW."opening_date_precision", NEW."opening_year", NEW."operating_season", NEW."operator_id", NEW."park_type", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."phone", NEW."property_owner_id", NEW."ride_count", NEW."search_text", NEW."size_acres", NEW."slug", NEW."status", NEW."timezone", NEW."updated_at", NEW."url", NEW."website"); RETURN NULL;',
                    hash="ba8a1efa2a6987e5803856a7d583d15379374976",
                    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", "closing_date_precision", "coaster_count", "created_at", "description", "email", "id", "name", "opening_date", "opening_date_precision", "opening_year", "operating_season", "operator_id", "park_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "phone", "property_owner_id", "ride_count", "search_text", "size_acres", "slug", "status", "timezone", "updated_at", "url", "website") VALUES (NEW."average_rating", NEW."banner_image_id", NEW."card_image_id", NEW."closing_date", NEW."closing_date_precision", NEW."coaster_count", NEW."created_at", NEW."description", NEW."email", NEW."id", NEW."name", NEW."opening_date", NEW."opening_date_precision", NEW."opening_year", NEW."operating_season", NEW."operator_id", NEW."park_type", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."phone", NEW."property_owner_id", NEW."ride_count", NEW."search_text", NEW."size_acres", NEW."slug", NEW."status", NEW."timezone", NEW."updated_at", NEW."url", NEW."website"); RETURN NULL;',
                    hash="03e752224a0f76749f4348abf48cb9e6929c9e19",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_19f56",
                    table="parks_park",
                    when="AFTER",
                ),
            ),
        ),
    ]
