# Generated by Django 3.1.4 on 2020-12-17 16:27

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('api', '0004_auto_20201107_0227'),
    ]

    operations = [
        migrations.CreateModel(
            name='SpeedTestClient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('uri', models.URLField(unique=True)),
                ('active', models.BooleanField(default=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='speedtestsclient', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='SpeedTestResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField(editable=False)),
                ('ping', models.DecimalField(decimal_places=4, default=0.0, editable=False, max_digits=16)),
                ('bytes_received', models.IntegerField(default=0, editable=False)),
                ('bytes_sent', models.IntegerField(default=0, editable=False)),
                ('download_bytes', models.DecimalField(decimal_places=4, default=0.0, editable=False, max_digits=16)),
                ('upload_bytes', models.DecimalField(decimal_places=4, default=0.0, editable=False, max_digits=16)),
                ('image_url', models.URLField(editable=False)),
            ],
        ),
        migrations.CreateModel(
            name='SpeedTestServer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('host', models.CharField(max_length=259, validators=[api.models.HostValidator])),
                ('server_id', models.IntegerField(unique=True)),
                ('name', models.CharField(max_length=256)),
                ('sponsor', models.CharField(blank=True, max_length=256)),
                ('country', models.CharField(blank=True, max_length=64)),
                ('country_code', models.CharField(blank=True, max_length=10)),
                ('distance_km', models.DecimalField(decimal_places=5, editable=False, max_digits=10)),
                ('latitude', models.DecimalField(decimal_places=4, editable=False, max_digits=8)),
                ('longitude', models.DecimalField(decimal_places=4, editable=False, max_digits=8)),
            ],
        ),
        migrations.RemoveField(
            model_name='speedtest',
            name='data',
        ),
        migrations.RemoveField(
            model_name='speedtest',
            name='node',
        ),
        migrations.DeleteModel(
            name='TestNode',
        ),
        migrations.AddField(
            model_name='speedtestresult',
            name='server',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.speedtestserver'),
        ),
        migrations.AddField(
            model_name='speedtest',
            name='client',
            field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='api.speedtestclient'),
        ),
        migrations.AddField(
            model_name='speedtest',
            name='result',
            field=models.OneToOneField(blank=True, default=0, editable=False, on_delete=django.db.models.deletion.CASCADE, to='api.speedtestresult'),
        ),
    ]
