# Generated by Django 4.2.6 on 2024-09-02 16:56

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"),
        ("tests", "0010_bigautofieldmodel_bigautofieldmodelevent_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="IgnoreAutoFieldsSnapshotModelCreatedAtUpdatedAtMyCharFieldMyIntFieldEvent",
            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.")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("my_char_field", models.CharField(max_length=32)),
                ("my_int_field", models.IntegerField()),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="SnapshotUntrackedField",
            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.")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("my_char_field", models.CharField(max_length=32)),
                ("my_int_field", models.IntegerField()),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.RemoveField(
            model_name="ignoreautofieldssnapshotmodelevent",
            name="pgh_context",
        ),
        migrations.RemoveField(
            model_name="ignoreautofieldssnapshotmodelevent",
            name="pgh_obj",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            name="update_update",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            name="delete_delete",
        ),
        migrations.AddField(
            model_name="ignoreautofieldssnapshotmodel",
            name="untracked_field",
            field=models.CharField(default="", max_length=32),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name="bigautofieldmodelevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="bigautofieldmodelevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                related_query_name="+",
                to="tests.bigautofieldmodel",
            ),
        ),
        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",
                related_query_name="+",
                to="tests.eventmodel",
            ),
        ),
        migrations.AlterField(
            model_name="customeventwithcontext",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="customeventwithcontext",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="tests.eventmodel",
            ),
        ),
        migrations.AlterField(
            model_name="custommodelevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="custommodelevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                related_query_name="+",
                to="tests.custommodel",
            ),
        ),
        migrations.AlterField(
            model_name="custommodelsnapshot",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="custommodelsnapshot",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="snapshot",
                related_query_name="+",
                to="tests.custommodel",
            ),
        ),
        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",
                related_query_name="+",
                to="tests.snapshotmodel",
            ),
        ),
        migrations.AlterField(
            model_name="denormcontextevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                related_query_name="+",
                to="tests.denormcontext",
            ),
        ),
        migrations.AlterField(
            model_name="denormcontexteventnoid",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="event_no_id",
                related_query_name="+",
                to="tests.denormcontext",
            ),
        ),
        migrations.AlterField(
            model_name="eventmodelevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="eventmodelevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                related_query_name="+",
                to="tests.eventmodel",
            ),
        ),
        migrations.AlterField(
            model_name="nopghobjevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="nopghobjsnapshot",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotimagefieldevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotimagefieldevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                related_query_name="+",
                to="tests.snapshotimagefield",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodeldtfieldevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodeldtfieldevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="dt_field_snapshot",
                related_query_name="+",
                to="tests.snapshotmodel",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodeldtfieldintfieldevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodeldtfieldintfieldevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="dt_field_int_field_snapshot",
                related_query_name="+",
                to="tests.snapshotmodel",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodelsnapshot",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="snapshotmodelsnapshot",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="snapshot",
                related_query_name="+",
                to="tests.snapshotmodel",
            ),
        ),
        migrations.AlterField(
            model_name="uniqueconstraintmodelevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AlterField(
            model_name="uniqueconstraintmodelevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="snapshot",
                related_query_name="+",
                to="tests.uniqueconstraintmodel",
            ),
        ),
        migrations.AlterField(
            model_name="usergroupsevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="untracked_field_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."untracked_field" IS DISTINCT FROM (NEW."untracked_field"))',  # noqa: E501
                    func='INSERT INTO "tests_snapshotuntrackedfield" ("created_at", "my_char_field", "my_int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (OLD."created_at", OLD."my_char_field", OLD."my_int_field", _pgh_attach_context(), NOW(), \'untracked_field\', OLD."id", OLD."updated_at"); RETURN NULL;',  # noqa: E501
                    hash="50331a8cb3c6489cd9d2dbd7c46d37d31ce4a331",
                    operation="UPDATE",
                    pgid="pgtrigger_untracked_field_update_26029",
                    table="tests_ignoreautofieldssnapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition='WHEN (OLD."my_char_field" IS DISTINCT FROM (NEW."my_char_field") OR OLD."my_int_field" IS DISTINCT FROM (NEW."my_int_field"))',  # noqa: E501
                    func='INSERT INTO "tests_ignoreautofieldssnapshotmodelcreatedatupdatedatmychardc6b" ("created_at", "my_char_field", "my_int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (OLD."created_at", OLD."my_char_field", OLD."my_int_field", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."updated_at"); RETURN NULL;',  # noqa: E501
                    hash="bc2e4b046f2c8570dc9116807f33f3c09173998c",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_9dd1b",
                    table="tests_ignoreautofieldssnapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ignoreautofieldssnapshotmodel",
            trigger=pgtrigger.compiler.Trigger(
                name="delete_delete",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "tests_ignoreautofieldssnapshotmodelcreatedatupdatedatmychardc6b" ("created_at", "my_char_field", "my_int_field", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (OLD."created_at", OLD."my_char_field", OLD."my_int_field", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."updated_at"); RETURN NULL;',  # noqa: E501
                    hash="aa91265c174b305edbfe6f2d2742522912503a2f",
                    operation="DELETE",
                    pgid="pgtrigger_delete_delete_42ea6",
                    table="tests_ignoreautofieldssnapshotmodel",
                    when="AFTER",
                ),
            ),
        ),
        migrations.DeleteModel(
            name="IgnoreAutoFieldsSnapshotModelEvent",
        ),
        migrations.AddField(
            model_name="snapshotuntrackedfield",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="snapshotuntrackedfield",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="untracked_field_event",
                related_query_name="+",
                to="tests.ignoreautofieldssnapshotmodel",
            ),
        ),
        migrations.AddField(
            model_name="ignoreautofieldssnapshotmodelcreatedatupdatedatmycharfieldmyintfieldevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="ignoreautofieldssnapshotmodelcreatedatupdatedatmycharfieldmyintfieldevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="no_auto_fields_event",
                related_query_name="+",
                to="tests.ignoreautofieldssnapshotmodel",
            ),
        ),
    ]
