# Generated by Django 3.1.7 on 2021-03-25 10:55

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import telemetry.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('api', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Telemetry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('transport', models.CharField(choices=[('http', 'http'), ('mqtt', 'mqtt')], default='http', max_length=4)),
                ('clock', models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('payload', models.JSONField(validators=[telemetry.models.telemetry_validation])),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.device')),
            ],
            options={
                'verbose_name_plural': 'Telemetry',
                'ordering': ['-time', 'device'],
                'unique_together': {('time', 'device')},
            },
        ),
    ]
