# Generated by Django 3.0.1 on 2019-12-26 14:35

import uuid

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

try:
    from django.db.models import JSONField
except ImportError:
    from django.contrib.postgres.fields.jsonb import JSONField


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AuditEvent',
            fields=[
                ('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='Timestamp')),
                ('remote_addr', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP address')),
                ('url', models.URLField(blank=True, null=True, verbose_name='URL')),
                ('query_params', JSONField(blank=True, default=dict, null=True, verbose_name='Query params')),
                ('post_data', JSONField(blank=True, default=dict, null=True, verbose_name='Post data')),
                ('object_id', models.PositiveIntegerField()),
                ('content', JSONField(default=dict, verbose_name='Content')),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'ordering': ('-timestamp',),
                'verbose_name': 'Audit event',
                'verbose_name_plural': 'Audit events',
                'abstract': False,
                'swappable': 'AUDIT_EVENT_MODEL',
            },
        ),
    ]
