# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-30 17:14
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Measurement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('value', models.CharField(max_length=128)),
            ],
            options={
                'ordering': ('node', 'sensor', 'date'),
            },
        ),
        migrations.CreateModel(
            name='Node',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, verbose_name='Name')),
                ('token', models.CharField(blank=True, max_length=40)),
                ('desc', models.CharField(blank=True, max_length=256, verbose_name='Description')),
                ('location', models.CharField(blank=True, max_length=256, verbose_name='Location')),
                ('ip', models.GenericIPAddressField(verbose_name='IP')),
            ],
        ),
        migrations.CreateModel(
            name='Sensor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, verbose_name='Name')),
                ('desc', models.CharField(blank=True, max_length=256, verbose_name='Description')),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, verbose_name='Name')),
                ('variable', models.CharField(max_length=4, verbose_name='Variable')),
            ],
        ),
        migrations.AddField(
            model_name='sensor',
            name='units',
            field=models.ManyToManyField(to='gui.Unit'),
        ),
        migrations.AddField(
            model_name='node',
            name='sensors',
            field=models.ManyToManyField(to='gui.Sensor'),
        ),
        migrations.AddField(
            model_name='measurement',
            name='node',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gui.Node'),
        ),
        migrations.AddField(
            model_name='measurement',
            name='sensor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gui.Sensor'),
        ),
        migrations.AddField(
            model_name='measurement',
            name='unit',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gui.Unit'),
        ),
        migrations.AlterUniqueTogether(
            name='node',
            unique_together=set([('name', 'token')]),
        ),
    ]
