# Generated by Django 2.0.6 on 2018-06-09 16:32

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Latency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('messages', models.BigIntegerField(default=0, help_text='the number of successful pings (excludes timeouts)')),
                ('timeouts', models.BigIntegerField(default=0, help_text='the number of unsuccessful pings')),
                ('total', models.FloatField(default=0.0, help_text='the sum of all latencies in milliseconds')),
                ('squares', models.FloatField(default=0.0, help_text='the sum of all latencies squared in milliseconds')),
                ('fastest', models.FloatField(default=0.0, help_text='the minimum latency in milliseconds')),
                ('slowest', models.FloatField(default=0.0, help_text='the maximum latency in milliseconds')),
                ('mean', models.FloatField(default=0.0, editable=False, help_text='the computed latency mean in milliseconds')),
                ('stddev', models.FloatField(default=0.0, editable=False, help_text='the computed latency standard deviation in milliseconds')),
                ('variance', models.FloatField(default=0.0, editable=False, help_text='the computed latency variance in milliseconds')),
                ('range', models.FloatField(default=0.0, editable=False, help_text='the computed latency range in milliseconds')),
            ],
            options={
                'verbose_name_plural': 'latencies',
                'db_table': 'latencies',
                'get_latest_by': 'modified',
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('location', models.CharField(blank=True, default='', help_text='text description of the location (e.g. city, state)', max_length=255, null=True)),
                ('latitude', models.DecimalField(decimal_places=6, help_text='latitude of the location', max_digits=10)),
                ('longitude', models.DecimalField(decimal_places=6, help_text='longitude of the location', max_digits=10)),
            ],
            options={
                'db_table': 'locations',
                'get_latest_by': 'modified',
            },
        ),
        migrations.CreateModel(
            name='Replica',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('name', models.SlugField(blank=True, help_text='unique name of the replica (hostname-pid) by default', max_length=255, unique=True)),
                ('active', models.BooleanField(default=True, help_text='the replica is currently under management')),
                ('precedence', models.PositiveSmallIntegerField(blank=True, default=0, help_text='the precedence of the replica over other replicas')),
                ('hostname', models.CharField(blank=True, help_text='identifying name of the host machine', max_length=255, null=True)),
                ('domain', models.CharField(blank=True, default='', help_text='domain name for the specified host if supplied', max_length=255, null=True)),
                ('ip_address', models.GenericIPAddressField(help_text='the IP address replicas can connect to')),
                ('port', models.IntegerField(default=3264, help_text='the port the replica is listening for consensus on')),
                ('last_seen', models.DateTimeField(editable=False, help_text='the time of the last ping from the replica', null=True)),
                ('api_key', models.CharField(editable=False, help_text='generated API key that identifies a host', max_length=45, unique=True)),
                ('location', models.ForeignKey(blank=True, help_text='the GeoIP location of the replica', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='replicas', to='replicas.Location')),
            ],
            options={
                'db_table': 'replicas',
                'ordering': ('precedence', 'last_seen'),
                'get_latest_by': 'last_seen',
            },
        ),
        migrations.AlterUniqueTogether(
            name='location',
            unique_together={('latitude', 'longitude')},
        ),
        migrations.AddField(
            model_name='latency',
            name='source',
            field=models.ForeignKey(help_text='the replica where the ping originates', on_delete=django.db.models.deletion.CASCADE, related_name='latencies', to='replicas.Replica'),
        ),
        migrations.AddField(
            model_name='latency',
            name='target',
            field=models.ForeignKey(help_text='the target of the ping to measure RTT to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='replicas.Replica'),
        ),
        migrations.AlterUniqueTogether(
            name='latency',
            unique_together={('source', 'target')},
        ),
    ]

# Generated by Django 2.0.6 on 2018-06-09 16:32

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Latency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('messages', models.BigIntegerField(default=0, help_text='the number of successful pings (excludes timeouts)')),
                ('timeouts', models.BigIntegerField(default=0, help_text='the number of unsuccessful pings')),
                ('total', models.FloatField(default=0.0, help_text='the sum of all latencies in milliseconds')),
                ('squares', models.FloatField(default=0.0, help_text='the sum of all latencies squared in milliseconds')),
                ('fastest', models.FloatField(default=0.0, help_text='the minimum latency in milliseconds')),
                ('slowest', models.FloatField(default=0.0, help_text='the maximum latency in milliseconds')),
                ('mean', models.FloatField(default=0.0, editable=False, help_text='the computed latency mean in milliseconds')),
                ('stddev', models.FloatField(default=0.0, editable=False, help_text='the computed latency standard deviation in milliseconds')),
                ('variance', models.FloatField(default=0.0, editable=False, help_text='the computed latency variance in milliseconds')),
                ('range', models.FloatField(default=0.0, editable=False, help_text='the computed latency range in milliseconds')),
            ],
            options={
                'verbose_name_plural': 'latencies',
                'db_table': 'latencies',
                'get_latest_by': 'modified',
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('location', models.CharField(blank=True, default='', help_text='text description of the location (e.g. city, state)', max_length=255, null=True)),
                ('latitude', models.DecimalField(decimal_places=6, help_text='latitude of the location', max_digits=10)),
                ('longitude', models.DecimalField(decimal_places=6, help_text='longitude of the location', max_digits=10)),
            ],
            options={
                'db_table': 'locations',
                'get_latest_by': 'modified',
            },
        ),
        migrations.CreateModel(
            name='Replica',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('name', models.SlugField(blank=True, help_text='unique name of the replica (hostname-pid) by default', max_length=255, unique=True)),
                ('active', models.BooleanField(default=True, help_text='the replica is currently under management')),
                ('precedence', models.PositiveSmallIntegerField(blank=True, default=0, help_text='the precedence of the replica over other replicas')),
                ('hostname', models.CharField(blank=True, help_text='identifying name of the host machine', max_length=255, null=True)),
                ('domain', models.CharField(blank=True, default='', help_text='domain name for the specified host if supplied', max_length=255, null=True)),
                ('ip_address', models.GenericIPAddressField(help_text='the IP address replicas can connect to')),
                ('port', models.IntegerField(default=3264, help_text='the port the replica is listening for consensus on')),
                ('last_seen', models.DateTimeField(editable=False, help_text='the time of the last ping from the replica', null=True)),
                ('api_key', models.CharField(editable=False, help_text='generated API key that identifies a host', max_length=45, unique=True)),
                ('location', models.ForeignKey(blank=True, help_text='the GeoIP location of the replica', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='replicas', to='replicas.Location')),
            ],
            options={
                'db_table': 'replicas',
                'ordering': ('precedence', 'last_seen'),
                'get_latest_by': 'last_seen',
            },
        ),
        migrations.AlterUniqueTogether(
            name='location',
            unique_together={('latitude', 'longitude')},
        ),
        migrations.AddField(
            model_name='latency',
            name='source',
            field=models.ForeignKey(help_text='the replica where the ping originates', on_delete=django.db.models.deletion.CASCADE, related_name='latencies', to='replicas.Replica'),
        ),
        migrations.AddField(
            model_name='latency',
            name='target',
            field=models.ForeignKey(help_text='the target of the ping to measure RTT to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='replicas.Replica'),
        ),
        migrations.AlterUniqueTogether(
            name='latency',
            unique_together={('source', 'target')},
        ),
    ]

# Generated by Django 2.0.6 on 2018-06-09 16:32