# Generated by Django 2.2.11 on 2020-03-11 00:36

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='AGEvent',
            fields=[
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=40)),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('description', models.CharField(blank=True, max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='AGSensorType',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=1024)),
                ('processing_formula', models.IntegerField(default=0)),
                ('format', django.contrib.postgres.fields.jsonb.JSONField()),
            ],
        ),
        migrations.CreateModel(
            name='AGVenue',
            fields=[
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=100)),
                ('description', models.CharField(blank=True, max_length=100)),
                ('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
                ('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='AGSensor',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=1024)),
                ('type_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='ag_data.AGSensorType')),
            ],
        ),
        migrations.CreateModel(
            name='AGMeasurement',
            fields=[
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('value', django.contrib.postgres.fields.jsonb.JSONField()),
                ('event_uuid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ag_data.AGEvent')),
                ('sensor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ag_data.AGSensor')),
            ],
        ),
        migrations.AddField(
            model_name='agevent',
            name='venue_uuid',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ag_data.AGVenue'),
        ),
    ]
