# Generated by Django 2.2 on 2019-04-04 18:39

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='RequestLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('requested_at', models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='Time the initial request was received')),
                ('response_ms', models.PositiveIntegerField(default=0, help_text='Time it took to process the request in milliseconds')),
                ('path', models.CharField(db_index=True, help_text='URL path for the request', max_length=200)),
                ('view', models.CharField(blank=True, db_index=True, help_text='Method that was called to process the request', max_length=200, null=True)),
                ('view_method', models.CharField(blank=True, db_index=True, help_text='HTTP Method of the request', max_length=30, null=True)),
                ('remote_addr', models.GenericIPAddressField(blank=True, help_text='Remote IP Address of the system that made the requested', null=True)),
                ('host', models.URLField(blank=True, help_text='Host of the system that received the request', null=True)),
                ('method', models.CharField(help_text='HTTP Method of the request', max_length=10)),
                ('query_params', models.TextField(blank=True, help_text='Data received in the URL as Query Parameters', null=True)),
                ('data', models.TextField(blank=True, help_text='Data received in the Body/JSON of the request', null=True)),
                ('response', models.TextField(blank=True, help_text='Data sent back to the remote system', null=True)),
                ('errors', models.TextField(blank=True, help_text='Errors raised in processing the request', null=True)),
                ('status_code', models.PositiveIntegerField(blank=True, help_text='HTTP response status code', null=True)),
                ('user', models.ForeignKey(blank=True, help_text='User that requested the page', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Request Log',
            },
        ),
        migrations.CreateModel(
            name='EventLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('occurred_at', models.DateTimeField(default=django.utils.timezone.now, help_text='Time the event occurred')),
                ('level', models.CharField(choices=[('D', 'Debug'), ('E', 'Error'), ('F', 'Fatal'), ('I', 'Info'), ('T', 'Trace'), ('W', 'Warn')], help_text='Level of severity the event', max_length=1)),
                ('message', models.TextField(blank=True, help_text='Event message', null=True)),
                ('user', models.ForeignKey(blank=True, help_text='User that caused the event', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Event Log',
            },
        ),
    ]
