# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-24 01:20
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='ConsolidatedData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dateInit', models.DateTimeField(auto_now_add=True, verbose_name='Initial DateTime')),
                ('dateEnd', models.DateTimeField(auto_now_add=True, verbose_name='Final DateTime')),
            ],
            options={
                'verbose_name_plural': 'ConsolidatedData',
                'db_table': 'consolidateddata',
            },
        ),
        migrations.CreateModel(
            name='Floor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=12, verbose_name='Code')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
            ],
            options={
                'verbose_name_plural': 'Floors',
                'db_table': 'floor',
            },
        ),
        migrations.CreateModel(
            name='Measurement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('unit', models.CharField(max_length=10, verbose_name='Unit')),
            ],
            options={
                'verbose_name_plural': 'Measurements',
                'db_table': 'measurement',
            },
        ),
        migrations.CreateModel(
            name='RealTimeData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True, verbose_name='DateTime')),
                ('value', models.DecimalField(decimal_places=2, default=0.0, max_digits=5, verbose_name='Value')),
            ],
            options={
                'verbose_name_plural': 'RealTimeData',
                'db_table': 'realtimedata',
            },
        ),
        migrations.CreateModel(
            name='Room',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=12, verbose_name='Code')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('floor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rooms', to='dashboard.Floor')),
            ],
            options={
                'verbose_name_plural': 'Rooms',
                'db_table': 'room',
            },
        ),
        migrations.CreateModel(
            name='Sensor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=12, verbose_name='Code')),
                ('measurement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sensors', to='dashboard.Measurement')),
                ('room', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sensors', to='dashboard.Room')),
            ],
            options={
                'verbose_name_plural': 'Sensors',
                'db_table': 'sensor',
            },
        ),
        migrations.AddField(
            model_name='realtimedata',
            name='sensor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='realtimedata', to='dashboard.Sensor'),
        ),
        migrations.AddField(
            model_name='consolidateddata',
            name='measurement',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='consolidateddata', to='dashboard.Measurement'),
        ),
        migrations.AddField(
            model_name='consolidateddata',
            name='room',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='consolidateddata', to='dashboard.Room'),
        ),
    ]
