# Generated by Django 3.2.15 on 2022-08-08 19:20

from django.db import migrations
import pgtrigger
import pgtrigger.migrations

import pghistory.tests.models
import pghistory.trigger


class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
        ('tests', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserGroups',
            fields=[],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('auth.user_groups',),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='custommodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(('old__int_field__df', pgtrigger.F('new__int_field'))),
                event_model=pghistory.tests.models.CustomModelEvent,
                label='int_field_updated',
                name='int_field_updated',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='custommodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.CustomModelSnapshot,
                label='snapshot',
                name='snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='custommodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__my_pk__df', pgtrigger.F('new__my_pk')),
                    ('old__int_field__df', pgtrigger.F('new__int_field')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.CustomModelSnapshot,
                label='snapshot',
                name='snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='eventmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.EventModelEvent,
                label='model.create',
                name='model_create',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='eventmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.EventModelEvent,
                label='before_update',
                name='before_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='OLD',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='eventmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.EventModelEvent,
                label='before_delete',
                name='before_delete',
                operation=pgtrigger.Operation(name='DELETE'),
                snapshot='OLD',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='eventmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(('old__dt_field__df', pgtrigger.F('new__dt_field'))),
                event_model=pghistory.tests.models.EventModelEvent,
                label='after_update',
                name='after_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='eventmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.CustomEventModel,
                label='model.custom_create',
                name='model_custom_create',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.NoPghObjSnapshot,
                label='no_pgh_obj_snapshot',
                name='no_pgh_obj_snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__dt_field__df', pgtrigger.F('new__dt_field')),
                    ('old__int_field__df', pgtrigger.F('new__int_field')),
                    ('old__fk_field__df', pgtrigger.F('new__fk_field')),
                    ('old__id__df', pgtrigger.F('new__id')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.NoPghObjSnapshot,
                label='no_pgh_obj_snapshot',
                name='no_pgh_obj_snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.SnapshotModelSnapshot,
                label='snapshot',
                name='snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__dt_field__df', pgtrigger.F('new__dt_field')),
                    ('old__int_field__df', pgtrigger.F('new__int_field')),
                    ('old__fk_field__df', pgtrigger.F('new__fk_field')),
                    ('old__id__df', pgtrigger.F('new__id')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.SnapshotModelSnapshot,
                label='snapshot',
                name='snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.SnapshotModelDtFieldIntFieldEvent,
                label='dt_field_int_field_snapshot',
                name='dt_field_int_field_snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__dt_field__df', pgtrigger.F('new__dt_field')),
                    ('old__int_field__df', pgtrigger.F('new__int_field')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.SnapshotModelDtFieldIntFieldEvent,
                label='dt_field_int_field_snapshot',
                name='dt_field_int_field_snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.SnapshotModelDtFieldEvent,
                label='dt_field_snapshot',
                name='dt_field_snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(('old__dt_field__df', pgtrigger.F('new__dt_field'))),
                event_model=pghistory.tests.models.SnapshotModelDtFieldEvent,
                label='dt_field_snapshot',
                name='dt_field_snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.CustomSnapshotModel,
                label='custom_snapshot',
                name='custom_snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='snapshotmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__int_field__df', pgtrigger.F('new__int_field')),
                    ('old__id__df', pgtrigger.F('new__id')),
                    ('old__fk_field__df', pgtrigger.F('new__fk_field')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.CustomSnapshotModel,
                label='custom_snapshot',
                name='custom_snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='uniqueconstraintmodel',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.UniqueConstraintModelEvent,
                label='snapshot',
                name='snapshot_insert',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='uniqueconstraintmodel',
            trigger=pghistory.trigger.Event(
                condition=pgtrigger.Q(
                    ('old__my_one_to_one__df', pgtrigger.F('new__my_one_to_one')),
                    ('old__my_char_field__df', pgtrigger.F('new__my_char_field')),
                    ('old__my_int_field1__df', pgtrigger.F('new__my_int_field1')),
                    ('old__my_int_field2__df', pgtrigger.F('new__my_int_field2')),
                    ('old__id__df', pgtrigger.F('new__id')),
                    _connector='OR',
                ),
                event_model=pghistory.tests.models.UniqueConstraintModelEvent,
                label='snapshot',
                name='snapshot_update',
                operation=pgtrigger.Operation(name='UPDATE'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='usergroups',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.UserGroupsEvent,
                label='group.add',
                name='group_add',
                operation=pgtrigger.Operation(name='INSERT'),
                snapshot='NEW',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name='usergroups',
            trigger=pghistory.trigger.Event(
                condition=None,
                event_model=pghistory.tests.models.UserGroupsEvent,
                label='group.remove',
                name='group_remove',
                operation=pgtrigger.Operation(name='DELETE'),
                snapshot='OLD',
                when=pgtrigger.When(name='AFTER'),
            ),
        ),
    ]
