# Generated by Django 4.0.2 on 2022-02-15 00:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='LoginEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('login_type', models.SmallIntegerField(choices=[(0, 'Login'), (1, 'Logout'), (2, 'Failed login')], verbose_name='Event type')),
                ('user_pk_as_string', models.CharField(blank=True, help_text='String version of the user pk', max_length=255, null=True, verbose_name='User PK as string')),
                ('remote_ip', models.CharField(db_index=True, max_length=50, null=True, verbose_name='Remote IP')),
                ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date time')),
            ],
            options={
                'verbose_name': 'login event',
                'verbose_name_plural': 'login events',
                'ordering': ['-datetime'],
            },
        ),
        migrations.CreateModel(
            name='RequestEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.CharField(db_index=True, max_length=254, verbose_name='URL')),
                ('method', models.CharField(db_index=True, max_length=20, verbose_name='Method')),
                ('query_string', models.TextField(null=True, verbose_name='Query string')),
                ('user_pk_as_string', models.CharField(blank=True, help_text='String version of the user pk', max_length=255, null=True, verbose_name='User PK as string')),
                ('remote_ip', models.CharField(db_index=True, max_length=50, null=True, verbose_name='Remote IP')),
                ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date time')),
            ],
            options={
                'verbose_name': 'request event',
                'verbose_name_plural': 'request events',
                'ordering': ['-datetime'],
            },
        ),
        migrations.CreateModel(
            name='CRUDEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event_type', models.SmallIntegerField(choices=[(1, 'Create'), (2, 'Update'), (3, 'Delete'), (4, 'Many-to-Many Change'), (5, 'Reverse Many-to-Many Change'), (6, 'Many-to-Many Add'), (7, 'Reverse Many-to-Many Add'), (8, 'Many-to-Many Remove'), (9, 'Reverse Many-to-Many Remove')], verbose_name='Event type')),
                ('object_id', models.CharField(max_length=255, verbose_name='Object ID')),
                ('object_repr', models.TextField(blank=True, null=True, verbose_name='Object representation')),
                ('object_json_repr', models.JSONField(blank=True, null=True, verbose_name='Object JSON representation')),
                ('changed_fields', models.JSONField(blank=True, null=True, verbose_name='Changed fields')),
                ('user_pk_as_string', models.CharField(blank=True, help_text='String version of the user pk', max_length=255, null=True, verbose_name='User PK as string')),
                ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date time')),
                ('content_type', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='Content type')),
            ],
            options={
                'verbose_name': 'CRUD event',
                'verbose_name_plural': 'CRUD events',
                'ordering': ['-datetime'],
                'index_together': {('object_id', 'content_type')},
            },
        ),
    ]
