# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-11 11:55
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='IPInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('org', models.CharField(blank=True, max_length=255, verbose_name='Organization')),
                ('asn', models.CharField(blank=True, max_length=255, verbose_name='ASN')),
                ('isp', models.CharField(blank=True, max_length=255, verbose_name='ISP')),
                ('proxy', models.NullBooleanField(max_length=255, verbose_name='Proxy')),
                ('hostname', models.CharField(blank=True, max_length=255, verbose_name='Hostname')),
                ('continent', models.CharField(blank=True, max_length=255, verbose_name='Continent')),
                ('continent_code', models.CharField(blank=True, max_length=255, verbose_name='Continent code')),
                ('country', models.CharField(blank=True, max_length=255, verbose_name='Country')),
                ('country_code', models.CharField(blank=True, max_length=255, verbose_name='Country code')),
                ('region', models.CharField(blank=True, max_length=255, verbose_name='Region')),
                ('region_code', models.CharField(blank=True, max_length=255, verbose_name='Region code')),
                ('city', models.CharField(blank=True, max_length=255, verbose_name='City')),
                ('city_code', models.CharField(blank=True, max_length=255, verbose_name='City code')),
                ('latitude', models.CharField(blank=True, max_length=255, verbose_name='Latitude')),
                ('longitude', models.CharField(blank=True, max_length=255, verbose_name='Longitude')),
            ],
            options={
                'verbose_name_plural': 'IP address information',
                'verbose_name': 'IP address information',
            },
        ),
        migrations.CreateModel(
            name='IPInfoCheck',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', models.GenericIPAddressField(unique=True, verbose_name='IP address')),
                ('date', models.DateField(default=datetime.date.today, verbose_name='Date')),
                ('ip_info', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meerkat.IPInfo', verbose_name='IPInfo')),
            ],
            options={
                'verbose_name_plural': 'IPInfo checks',
                'verbose_name': 'IPInfo check',
            },
        ),
        migrations.CreateModel(
            name='RequestLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('client_ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='Client IP address')),
                ('datetime', models.DateTimeField(blank=True, verbose_name='Datetime')),
                ('timezone', models.CharField(blank=True, max_length=10, verbose_name='Timezone')),
                ('url', models.URLField(blank=True, max_length=2047, verbose_name='URL')),
                ('status_code', models.SmallIntegerField(blank=True, verbose_name='Status code')),
                ('user_agent', models.TextField(blank=True, verbose_name='User agent')),
                ('referrer', models.TextField(blank=True, verbose_name='Referrer')),
                ('upstream', models.TextField(blank=True, verbose_name='Upstream')),
                ('host', models.TextField(blank=True, verbose_name='Host')),
                ('server', models.TextField(blank=True, verbose_name='Server')),
                ('verb', models.CharField(blank=True, max_length=30, verbose_name='Verb')),
                ('protocol', models.CharField(blank=True, max_length=30, verbose_name='Protocol')),
                ('port', models.PositiveIntegerField(blank=True, null=True, verbose_name='Port')),
                ('file_type', models.CharField(blank=True, max_length=30, verbose_name='File type')),
                ('https', models.BooleanField(default=False, verbose_name='HTTPS')),
                ('bytes_sent', models.IntegerField(blank=True, verbose_name='Bytes sent')),
                ('request', models.TextField(blank=True, verbose_name='Request')),
                ('error', models.BooleanField(default=False, verbose_name='Error')),
                ('level', models.CharField(blank=True, max_length=255, verbose_name='Level')),
                ('message', models.TextField(blank=True, verbose_name='Message')),
                ('ip_info', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='meerkat.IPInfo', verbose_name='IP Info')),
            ],
            options={
                'verbose_name_plural': 'Request logs',
                'verbose_name': 'Request log',
            },
        ),
        migrations.AlterUniqueTogether(
            name='ipinfo',
            unique_together=set([('latitude', 'longitude', 'hostname', 'city', 'region', 'country', 'org')]),
        ),
    ]
