# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-02 07:45
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('image', '0001_initial'),
        ('managementnode', '0001_initial'),
        ('provisioning', '0001_initial'),
        ('reservations', '0001_initial'),
        ('authentication', '0001_initial'),
        ('compute', '0001_initial'),
        ('core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Changelog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reservationid', models.IntegerField(blank=True, null=True)),
                ('start', models.DateTimeField(blank=True, null=True)),
                ('end', models.DateTimeField(blank=True, null=True)),
                ('remoteip', models.CharField(blank=True, db_column='remoteIP', max_length=15, null=True)),
                ('wasavailable', models.IntegerField(blank=True, null=True)),
                ('timestamp', models.DateTimeField()),
                ('other', models.CharField(blank=True, max_length=255, null=True)),
                ('computerid', models.ForeignKey(blank=True, db_column='computerid', null=True, on_delete=django.db.models.deletion.CASCADE, to='compute.Computer')),
            ],
            options={
                'db_table': 'changelog',
            },
        ),
        migrations.CreateModel(
            name='Computerloadlog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField(blank=True, null=True)),
                ('additionalinfo', models.TextField(blank=True, null=True)),
                ('computerid', models.ForeignKey(db_column='computerid', on_delete=django.db.models.deletion.CASCADE, to='compute.Computer')),
                ('loadstateid', models.ForeignKey(db_column='loadstateid', on_delete=django.db.models.deletion.CASCADE, to='compute.Computerloadstate')),
                ('reservationid', models.ForeignKey(db_column='reservationid', on_delete=django.db.models.deletion.CASCADE, to='reservations.Reservation')),
            ],
            options={
                'db_table': 'computerloadlog',
            },
        ),
        migrations.CreateModel(
            name='Connectlog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reservationid', models.IntegerField()),
                ('remoteip', models.CharField(db_column='remoteIP', max_length=39)),
                ('verified', models.IntegerField()),
                ('timestamp', models.DateTimeField()),
            ],
            options={
                'db_table': 'connectlog',
            },
        ),
        migrations.CreateModel(
            name='Log',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nowfuture', models.CharField(max_length=6)),
                ('start', models.DateTimeField()),
                ('loaded', models.DateTimeField(blank=True, null=True)),
                ('initialend', models.DateTimeField()),
                ('finalend', models.DateTimeField()),
                ('wasavailable', models.IntegerField()),
                ('ending', models.CharField(max_length=10)),
                ('requestid', models.IntegerField(blank=True, null=True)),
                ('remoteip', models.CharField(blank=True, db_column='remoteIP', max_length=15, null=True)),
                ('size', models.SmallIntegerField()),
                ('computerid', models.ForeignKey(blank=True, db_column='computerid', null=True, on_delete=django.db.models.deletion.CASCADE, to='compute.Computer')),
                ('imageid', models.ForeignKey(db_column='imageid', on_delete=django.db.models.deletion.CASCADE, to='image.Image')),
                ('userid', models.ForeignKey(db_column='userid', on_delete=django.db.models.deletion.CASCADE, to='authentication.User')),
            ],
            options={
                'db_table': 'log',
            },
        ),
        migrations.CreateModel(
            name='Loginlog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('user', models.CharField(max_length=50)),
                ('authmech', models.CharField(max_length=30)),
                ('timestamp', models.DateTimeField()),
                ('passfail', models.IntegerField()),
                ('remoteip', models.CharField(db_column='remoteIP', max_length=15)),
                ('code', models.CharField(max_length=19)),
                ('affiliationid', models.ForeignKey(db_column='affiliationid', on_delete=django.db.models.deletion.CASCADE, to='core.Affiliation')),
            ],
            options={
                'db_table': 'loginlog',
            },
        ),
        migrations.CreateModel(
            name='Natlog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('publicipaddress', models.CharField(db_column='publicIPaddress', max_length=15)),
                ('publicport', models.SmallIntegerField()),
                ('internalipaddress', models.CharField(blank=True, db_column='internalIPaddress', max_length=15, null=True)),
                ('internalport', models.SmallIntegerField()),
                ('protocol', models.CharField(max_length=3)),
                ('timestamp', models.DateTimeField()),
                ('nathostresourceid', models.ForeignKey(db_column='nathostresourceid', on_delete=django.db.models.deletion.CASCADE, to='provisioning.Resource')),
            ],
            options={
                'db_table': 'natlog',
            },
        ),
        migrations.CreateModel(
            name='Querylog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField()),
                ('mode', models.CharField(max_length=30)),
                ('query', models.TextField()),
                ('userid', models.ForeignKey(db_column='userid', on_delete=django.db.models.deletion.CASCADE, to='authentication.User')),
            ],
            options={
                'db_table': 'querylog',
            },
        ),
        migrations.CreateModel(
            name='Sublog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ipaddress', models.CharField(blank=True, db_column='IPaddress', max_length=15, null=True)),
                ('blockrequestid', models.IntegerField(db_column='blockRequestid')),
                ('blockstart', models.DateTimeField(db_column='blockStart')),
                ('blockend', models.DateTimeField(db_column='blockEnd')),
                ('computerid', models.ForeignKey(db_column='computerid', on_delete=django.db.models.deletion.CASCADE, related_name='computeid_rel', to='compute.Computer')),
                ('hostcomputerid', models.ForeignKey(blank=True, db_column='hostcomputerid', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='hostcompute_rel', to='compute.Computer')),
                ('imageid', models.ForeignKey(db_column='imageid', on_delete=django.db.models.deletion.CASCADE, to='image.Image')),
                ('imagerevisionid', models.ForeignKey(db_column='imagerevisionid', on_delete=django.db.models.deletion.CASCADE, to='image.Imagerevision')),
                ('logid', models.ForeignKey(db_column='logid', on_delete=django.db.models.deletion.CASCADE, to='logs.Log')),
                ('managementnodeid', models.ForeignKey(db_column='managementnodeid', on_delete=django.db.models.deletion.CASCADE, to='managementnode.Managementnode')),
                ('predictivemoduleid', models.ForeignKey(db_column='predictivemoduleid', on_delete=django.db.models.deletion.CASCADE, to='core.Module')),
            ],
            options={
                'db_table': 'sublog',
            },
        ),
        migrations.CreateModel(
            name='Xmlrpclog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('xmlrpckeyid', models.SmallIntegerField(db_column='xmlrpcKeyid')),
                ('timestamp', models.DateTimeField()),
                ('ipaddress', models.CharField(blank=True, db_column='IPaddress', max_length=15, null=True)),
                ('method', models.CharField(blank=True, max_length=60, null=True)),
                ('apiversion', models.IntegerField()),
                ('comments', models.TextField(blank=True, null=True)),
            ],
            options={
                'db_table': 'xmlrpcLog',
            },
        ),
        migrations.AddField(
            model_name='natlog',
            name='sublogid',
            field=models.ForeignKey(db_column='sublogid', on_delete=django.db.models.deletion.CASCADE, to='logs.Sublog'),
        ),
        migrations.AddField(
            model_name='connectlog',
            name='logid',
            field=models.ForeignKey(db_column='logid', on_delete=django.db.models.deletion.CASCADE, to='logs.Log'),
        ),
        migrations.AddField(
            model_name='connectlog',
            name='userid',
            field=models.ForeignKey(blank=True, db_column='userid', null=True, on_delete=django.db.models.deletion.CASCADE, to='authentication.User'),
        ),
        migrations.AddField(
            model_name='changelog',
            name='logid',
            field=models.ForeignKey(db_column='logid', on_delete=django.db.models.deletion.CASCADE, to='logs.Log'),
        ),
        migrations.AddField(
            model_name='changelog',
            name='userid',
            field=models.ForeignKey(blank=True, db_column='userid', null=True, on_delete=django.db.models.deletion.CASCADE, to='authentication.User'),
        ),
        migrations.AlterUniqueTogether(
            name='natlog',
            unique_together=set([('sublogid', 'nathostresourceid', 'publicipaddress', 'publicport', 'internalipaddress', 'internalport', 'protocol')]),
        ),
        migrations.AlterUniqueTogether(
            name='connectlog',
            unique_together=set([('reservationid', 'userid', 'remoteip')]),
        ),
        migrations.AlterUniqueTogether(
            name='changelog',
            unique_together=set([('userid', 'reservationid', 'remoteip')]),
        ),
    ]
