<reponame>kbrdsk/woeip
# Generated by Django 2.1.10 on 2019-07-26 17:09
import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("air_quality", "0005_auto_20190614_2307"),
    ]

    operations = [
        migrations.CreateModel(
            name="Calibration",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("calibrated_at", models.DateTimeField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Collection",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("starts_at", models.DateTimeField()),
                ("ends_at", models.DateTimeField()),
                ("route", models.CharField(max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="CollectionFile",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("file", models.FileField(default="", upload_to="data")),
                ("uploaded_at", models.DateTimeField(auto_now_add=True)),
                ("processor_version", models.CharField(max_length=256)),
                ("processed_at", models.DateTimeField(auto_now=True)),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.Collection",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Pollutant",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=256)),
                ("description", models.CharField(max_length=1024)),
            ],
        ),
        migrations.CreateModel(
            name="PollutantValue",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("value", models.FloatField()),
                (
                    "collection_file",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.CollectionFile",
                    ),
                ),
                (
                    "pollutant",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="air_quality.Pollutant",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="TimeGeo",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("location", django.contrib.gis.db.models.fields.PointField(srid=4326)),
                ("time", models.DateTimeField()),
                (
                    "collection_file",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.CollectionFile",
                    ),
                ),
            ],
        ),
        migrations.RemoveField(model_name="data", name="session"),
        migrations.RemoveField(model_name="session", name="collected_by"),
        migrations.RemoveField(model_name="session", name="route"),
        migrations.AlterUniqueTogether(name="sessiondata", unique_together=set()),
        migrations.RemoveField(model_name="sessiondata", name="sensor"),
        migrations.RemoveField(model_name="sessiondata", name="session"),
        migrations.RemoveField(model_name="sessiondata", name="uploaded_by"),
        migrations.RenameField(
            model_name="device", old_name="firmware_version", new_name="firmware"
        ),
        migrations.RenameField(
            model_name="device", old_name="manufacturer", new_name="serial"
        ),
        migrations.RemoveField(model_name="device", name="calibration_date"),
        migrations.RemoveField(model_name="device", name="model_number"),
        migrations.RemoveField(model_name="device", name="serial_number"),
        migrations.AlterField(
            model_name="sensor",
            name="device",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Device",
            ),
        ),
        migrations.AlterField(
            model_name="sensor",
            name="unit",
            field=models.CharField(
                choices=[
                    ("mg/m3", "mg/m3"),
                    ("ppm", "ppm"),
                    ("g/m3", "g/m3"),
                    ("PM10", "PM10"),
                    ("PM2.5", "PM2.5"),
                    ("μg/m3", "μg/m3"),
                    ("latlon", "latlon"),
                ],
                help_text="Measurement unit, e.g., mg/m3, ppm, etc.",
                max_length=256,
            ),
        ),
        migrations.DeleteModel(name="Data"),
        migrations.DeleteModel(name="Route"),
        migrations.DeleteModel(name="Session"),
        migrations.DeleteModel(name="SessionData"),
        migrations.AddField(
            model_name="pollutantvalue",
            name="time_geo",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="air_quality.TimeGeo"
            ),
        ),
        migrations.AddField(
            model_name="collectionfile",
            name="sensor",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Sensor",
            ),
        ),
        migrations.AddField(
            model_name="collectionfile",
            name="user",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="calibration",
            name="sensor",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="air_quality.Sensor"
            ),
        ),
        migrations.AddField(
            model_name="calibration",
            name="user",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="sensor",
            name="pollutant",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Pollutant",
            ),
        ),
    ]

# Generated by Django 2.1.10 on 2019-07-26 17:09
import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("air_quality", "0005_auto_20190614_2307"),
    ]

    operations = [
        migrations.CreateModel(
            name="Calibration",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("calibrated_at", models.DateTimeField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Collection",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("starts_at", models.DateTimeField()),
                ("ends_at", models.DateTimeField()),
                ("route", models.CharField(max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="CollectionFile",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("file", models.FileField(default="", upload_to="data")),
                ("uploaded_at", models.DateTimeField(auto_now_add=True)),
                ("processor_version", models.CharField(max_length=256)),
                ("processed_at", models.DateTimeField(auto_now=True)),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.Collection",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Pollutant",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=256)),
                ("description", models.CharField(max_length=1024)),
            ],
        ),
        migrations.CreateModel(
            name="PollutantValue",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("value", models.FloatField()),
                (
                    "collection_file",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.CollectionFile",
                    ),
                ),
                (
                    "pollutant",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="air_quality.Pollutant",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="TimeGeo",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("location", django.contrib.gis.db.models.fields.PointField(srid=4326)),
                ("time", models.DateTimeField()),
                (
                    "collection_file",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="air_quality.CollectionFile",
                    ),
                ),
            ],
        ),
        migrations.RemoveField(model_name="data", name="session"),
        migrations.RemoveField(model_name="session", name="collected_by"),
        migrations.RemoveField(model_name="session", name="route"),
        migrations.AlterUniqueTogether(name="sessiondata", unique_together=set()),
        migrations.RemoveField(model_name="sessiondata", name="sensor"),
        migrations.RemoveField(model_name="sessiondata", name="session"),
        migrations.RemoveField(model_name="sessiondata", name="uploaded_by"),
        migrations.RenameField(
            model_name="device", old_name="firmware_version", new_name="firmware"
        ),
        migrations.RenameField(
            model_name="device", old_name="manufacturer", new_name="serial"
        ),
        migrations.RemoveField(model_name="device", name="calibration_date"),
        migrations.RemoveField(model_name="device", name="model_number"),
        migrations.RemoveField(model_name="device", name="serial_number"),
        migrations.AlterField(
            model_name="sensor",
            name="device",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Device",
            ),
        ),
        migrations.AlterField(
            model_name="sensor",
            name="unit",
            field=models.CharField(
                choices=[
                    ("mg/m3", "mg/m3"),
                    ("ppm", "ppm"),
                    ("g/m3", "g/m3"),
                    ("PM10", "PM10"),
                    ("PM2.5", "PM2.5"),
                    ("μg/m3", "μg/m3"),
                    ("latlon", "latlon"),
                ],
                help_text="Measurement unit, e.g., mg/m3, ppm, etc.",
                max_length=256,
            ),
        ),
        migrations.DeleteModel(name="Data"),
        migrations.DeleteModel(name="Route"),
        migrations.DeleteModel(name="Session"),
        migrations.DeleteModel(name="SessionData"),
        migrations.AddField(
            model_name="pollutantvalue",
            name="time_geo",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="air_quality.TimeGeo"
            ),
        ),
        migrations.AddField(
            model_name="collectionfile",
            name="sensor",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Sensor",
            ),
        ),
        migrations.AddField(
            model_name="collectionfile",
            name="user",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="calibration",
            name="sensor",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="air_quality.Sensor"
            ),
        ),
        migrations.AddField(
            model_name="calibration",
            name="user",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="sensor",
            name="pollutant",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="air_quality.Pollutant",
            ),
        ),
    ]
# Generated by Django 2.1.10 on 2019-07-26 17:09