# Generated by Django 4.2.6 on 2023-10-14 21:47

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


class Migration(migrations.Migration):
    dependencies = [
        ("tests", "0006_remove_custommodel_int_field_updated_and_more"),
    ]

    operations = [
        migrations.DeleteModel(
            name="CustomAggregateEvent",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="custommodel",
            name="snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="custommodel",
            name="snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="denormcontext",
            name="snapshot_no_id_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="denormcontext",
            name="snapshot_no_id_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="denormcontext",
            name="snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="denormcontext",
            name="snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="eventmodel",
            name="before_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            name="ignoreautofieldssnapshot_delete",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            name="ignoreautofieldssnapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotimagefield",
            name="snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotimagefield",
            name="snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="no_pgh_obj_snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="no_pgh_obj_snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="dt_field_int_field_snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="dt_field_snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="custom_snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="dt_field_int_field_snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="dt_field_snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="snapshotmodel",
            name="custom_snapshot_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="uniqueconstraintmodel",
            name="snapshot_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="uniqueconstraintmodel",
            name="snapshot_update",
        ),
        migrations.AlterField(
            model_name="customeventmodel",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="custom_related_name",
                to="tests.eventmodel",
            ),
        ),
        migrations.AlterField(
            model_name="customsnapshotmodel",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="custom_related_name",
                to="tests.snapshotmodel",
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="custommodel",
            trigger=pgtrigger.compiler.Trigger(
                name="insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_custommodelsnapshot" ("integer_field", "my_pk", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."integer_field", NEW."my_pk", _pgh_attach_context(), NOW(), \'insert\', NEW."my_pk"); RETURN NULL;',  # noqa
                    hash="7d000d081d29124dd9bef47e464c29216d33fb98",
                    operation="INSERT",
                    pgid="pgtrigger_insert_16db6",
                    table="tests_custommodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="custommodel",
            trigger=pgtrigger.compiler.Trigger(
                name="update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_custommodelsnapshot" ("integer_field", "my_pk", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."integer_field", NEW."my_pk", _pgh_attach_context(), NOW(), \'update\', NEW."my_pk"); RETURN NULL;',  # noqa
                    hash="859ada3ebe785f7966eb6d8256dfd20afdea3061",
                    operation="UPDATE",
                    pgid="pgtrigger_update_6031e",
                    table="tests_custommodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="denormcontext",
            trigger=pgtrigger.compiler.Trigger(
                name="snapshot_no_id_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_denormcontexteventnoid" ("fk_field_id", "id", "int_field", "pgh_context", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_metadata\', TRUE), \'\'), NULL)::JSONB, NOW(), \'snapshot_no_id_insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="b96a435e15e21df4abbaa0ffc2828dacf895789d",
                    operation="INSERT",
                    pgid="pgtrigger_snapshot_no_id_insert_f9f15",
                    table="tests_denormcontext",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="denormcontext",
            trigger=pgtrigger.compiler.Trigger(
                name="snapshot_no_id_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_denormcontexteventnoid" ("fk_field_id", "id", "int_field", "pgh_context", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_metadata\', TRUE), \'\'), NULL)::JSONB, NOW(), \'snapshot_no_id_update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="6e17d2ff416bd01448442d51640a04c6da9dce3f",
                    operation="UPDATE",
                    pgid="pgtrigger_snapshot_no_id_update_3c605",
                    table="tests_denormcontext",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="denormcontext",
            trigger=pgtrigger.compiler.Trigger(
                name="insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_denormcontextevent" ("fk_field_id", "id", "int_field", "pgh_context", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_metadata\', TRUE), \'\'), NULL)::JSONB, COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_id\', TRUE), \'\'), NULL)::UUID, NOW(), \'insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="9c3815200031961fe678c54de6dcebbc8608c491",
                    operation="INSERT",
                    pgid="pgtrigger_insert_80ef6",
                    table="tests_denormcontext",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="denormcontext",
            trigger=pgtrigger.compiler.Trigger(
                name="update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_denormcontextevent" ("fk_field_id", "id", "int_field", "pgh_context", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_metadata\', TRUE), \'\'), NULL)::JSONB, COALESCE(NULLIF(CURRENT_SETTING(\'pghistory.context_id\', TRUE), \'\'), NULL)::UUID, NOW(), \'update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="f0a9fbd3a80f7c5b3263f58838b366f7398e6b74",
                    operation="UPDATE",
                    pgid="pgtrigger_update_d2adb",
                    table="tests_denormcontext",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="eventmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="before_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_eventmodelevent" ("dt_field", "id", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (OLD."dt_field", OLD."id", OLD."int_field", _pgh_attach_context(), NOW(), \'before_update\', OLD."id"); RETURN NULL;',  # noqa
                    hash="f7e10e870a71a7bb419dd1ef7f331e754df322d2",
                    operation="UPDATE",
                    pgid="pgtrigger_before_update_aad5f",
                    table="tests_eventmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."my_char_field" IS DISTINCT FROM (NEW."my_char_field") OR OLD."my_int_field" IS DISTINCT FROM (NEW."my_int_field"))',  # noqa
                    func='INSERT INTO "tests_ignoreautofieldssnapshotmodelevent" ("created_at", "id", "my_char_field", "my_int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (OLD."created_at", OLD."id", OLD."my_char_field", OLD."my_int_field", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."updated_at"); RETURN NULL;',  # noqa
                    hash="e9b115ea0141e02f4e9066ca7c35d21b290c3d3d",
                    operation="UPDATE",
                    pgid="pgtrigger_update_b35c6",
                    table="tests_ignoreautofieldssnapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="delete",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_ignoreautofieldssnapshotmodelevent" ("created_at", "id", "my_char_field", "my_int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (OLD."created_at", OLD."id", OLD."my_char_field", OLD."my_int_field", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."updated_at"); RETURN NULL;',  # noqa
                    hash="1df2ca4a71c501b788c97ab9ccbe4301043f3bad",
                    operation="DELETE",
                    pgid="pgtrigger_delete_03c4e",
                    table="tests_ignoreautofieldssnapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotimagefield",
            trigger=pgtrigger.compiler.Trigger(
                name="insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_snapshotimagefieldevent" ("id", "img_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."id", NEW."img_field", _pgh_attach_context(), NOW(), \'insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="37536a94db100babf39a33019ef963df44f39f28",
                    operation="INSERT",
                    pgid="pgtrigger_insert_a495d",
                    table="tests_snapshotimagefield",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotimagefield",
            trigger=pgtrigger.compiler.Trigger(
                name="update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_snapshotimagefieldevent" ("id", "img_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."id", NEW."img_field", _pgh_attach_context(), NOW(), \'update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="c56c453b730e11cc354ef6bd7aa325b29bc5ccc9",
                    operation="UPDATE",
                    pgid="pgtrigger_update_e0476",
                    table="tests_snapshotimagefield",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="no_pgh_obj_snapshot_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_nopghobjsnapshot" ("dt_field", "fk_field_id", "id", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label") VALUES (NEW."dt_field", NEW."fk_field_id", NEW."id", NEW."int_field", _pgh_attach_context(), NOW(), \'no_pgh_obj_snapshot_insert\'); RETURN NULL;',  # noqa
                    hash="7638cc0a0691458a36cf5f1c72c410e4b0a91c90",
                    operation="INSERT",
                    pgid="pgtrigger_no_pgh_obj_snapshot_insert_d3501",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="no_pgh_obj_snapshot_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_nopghobjsnapshot" ("dt_field", "fk_field_id", "id", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label") VALUES (NEW."dt_field", NEW."fk_field_id", NEW."id", NEW."int_field", _pgh_attach_context(), NOW(), \'no_pgh_obj_snapshot_update\'); RETURN NULL;',  # noqa
                    hash="a1d886913dbd5878d2f5c599e25a03398b44ded1",
                    operation="UPDATE",
                    pgid="pgtrigger_no_pgh_obj_snapshot_update_015b7",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="snapshot_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_snapshotmodelsnapshot" ("dt_field", "fk_field_id", "id", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", NEW."fk_field_id", NEW."id", NEW."int_field", _pgh_attach_context(), NOW(), \'snapshot_insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="dae162c5ea45a56851ba81ee8f8f4264ea1977fd",
                    operation="INSERT",
                    pgid="pgtrigger_snapshot_insert_287a7",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="snapshot_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_snapshotmodelsnapshot" ("dt_field", "fk_field_id", "id", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", NEW."fk_field_id", NEW."id", NEW."int_field", _pgh_attach_context(), NOW(), \'snapshot_update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="3adc882aeb39c8e5bb753d7005191373b89a6349",
                    operation="UPDATE",
                    pgid="pgtrigger_snapshot_update_4041c",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="dt_field_int_field_snapshot_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_snapshotmodeldtfieldintfieldevent" ("dt_field", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", NEW."int_field", _pgh_attach_context(), NOW(), \'dt_field_int_field_snapshot_insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="fc82c063438624e226a7c85a978659c1ca4fbb0b",
                    operation="INSERT",
                    pgid="pgtrigger_dt_field_int_field_snapshot_insert_85480",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="dt_field_int_field_snapshot_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."dt_field" IS DISTINCT FROM (NEW."dt_field") OR OLD."int_field" IS DISTINCT FROM (NEW."int_field"))',  # noqa
                    func='INSERT INTO "tests_snapshotmodeldtfieldintfieldevent" ("dt_field", "int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", NEW."int_field", _pgh_attach_context(), NOW(), \'dt_field_int_field_snapshot_update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="2eaf949310b1dc46647ab4abb10686aaf8ac3307",
                    operation="UPDATE",
                    pgid="pgtrigger_dt_field_int_field_snapshot_update_8246d",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="dt_field_snapshot_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_snapshotmodeldtfieldevent" ("dt_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", _pgh_attach_context(), NOW(), \'dt_field_snapshot_insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="7d613cba8c24412bdd8127fe6bb53769d3a53211",
                    operation="INSERT",
                    pgid="pgtrigger_dt_field_snapshot_insert_f46b8",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="dt_field_snapshot_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."dt_field" IS DISTINCT FROM (NEW."dt_field"))',
                    func='INSERT INTO "tests_snapshotmodeldtfieldevent" ("dt_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."dt_field", _pgh_attach_context(), NOW(), \'dt_field_snapshot_update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="f07cb133cf3b2e9ea34a0b3cacdc69e15b0fb993",
                    operation="UPDATE",
                    pgid="pgtrigger_dt_field_snapshot_update_22f55",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="custom_snapshot_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_customsnapshotmodel" ("fk_field_id", "id", "int_field", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", NOW(), \'custom_snapshot_insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="8d4509a6407ddd272d5d473d10f3ee8ea0a3cb15",
                    operation="INSERT",
                    pgid="pgtrigger_custom_snapshot_insert_6d300",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="snapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="custom_snapshot_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."fk_field_id" IS DISTINCT FROM (NEW."fk_field_id") OR OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."int_field" IS DISTINCT FROM (NEW."int_field"))',  # noqa
                    func='INSERT INTO "tests_customsnapshotmodel" ("fk_field_id", "id", "int_field", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."fk_field_id", NEW."id", NEW."int_field", NOW(), \'custom_snapshot_update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="28145a9ce54b4029cdaa4933e0bcad06ff2a4869",
                    operation="UPDATE",
                    pgid="pgtrigger_custom_snapshot_update_5af3e",
                    table="tests_snapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="uniqueconstraintmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_uniqueconstraintmodelevent" ("id", "my_char_field", "my_int_field1", "my_int_field2", "my_one_to_one_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."id", NEW."my_char_field", NEW."my_int_field1", NEW."my_int_field2", NEW."my_one_to_one_id", _pgh_attach_context(), NOW(), \'insert\', NEW."id"); RETURN NULL;',  # noqa
                    hash="e04aacbb0bbb2026b3be5d22aaf62dbe4d1429eb",
                    operation="INSERT",
                    pgid="pgtrigger_insert_be3b4",
                    table="tests_uniqueconstraintmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="uniqueconstraintmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "tests_uniqueconstraintmodelevent" ("id", "my_char_field", "my_int_field1", "my_int_field2", "my_one_to_one_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id") VALUES (NEW."id", NEW."my_char_field", NEW."my_int_field1", NEW."my_int_field2", NEW."my_one_to_one_id", _pgh_attach_context(), NOW(), \'update\', NEW."id"); RETURN NULL;',  # noqa
                    hash="8e72e8d02b38b710d1f224fb6a496e1a82223675",
                    operation="UPDATE",
                    pgid="pgtrigger_update_26ef2",
                    table="tests_uniqueconstraintmodel",
                    when="AFTER",
                ),
            ),
        ),
    ]
