# Generated by Django 2.1.4 on 2019-10-29 10:14

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Control',
            fields=[
                ('date', models.DateTimeField(auto_now_add=True, primary_key=True, serialize=False)),
                ('operator', models.CharField(max_length=64)),
                ('switch_set1', models.IntegerField(blank=True, null=True)),
                ('switch_set2', models.IntegerField(blank=True, null=True)),
                ('switch_set3', models.IntegerField(blank=True, null=True)),
                ('leakage_current_set1', models.FloatField(blank=True, null=True)),
                ('leakage_current_set2', models.FloatField(blank=True, null=True)),
                ('leakage_current_set3', models.FloatField(blank=True, null=True)),
                ('power_factor_set1', models.FloatField(blank=True, null=True)),
                ('switch_delay_set1', models.FloatField(blank=True, null=True)),
                ('ct_var_value', models.FloatField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='DeviceData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('voltage1', models.FloatField()),
                ('voltage2', models.FloatField()),
                ('voltage3', models.FloatField()),
                ('current1', models.FloatField()),
                ('current2', models.FloatField()),
                ('current3', models.FloatField()),
                ('leakage_current1', models.FloatField()),
                ('leakage_current2', models.FloatField()),
                ('leakage_current3', models.FloatField()),
                ('switch1', models.IntegerField()),
                ('switch2', models.IntegerField()),
                ('switch3', models.IntegerField()),
                ('unbalanced_state1', models.FloatField()),
                ('power_factor1', models.FloatField()),
                ('capacitance_switch1', models.IntegerField(default=0, null=True)),
                ('capacitance_switch2', models.IntegerField(default=0, null=True)),
                ('capacitance_switch3', models.IntegerField(default=0, null=True)),
                ('capacitance_switch4', models.IntegerField(default=0, null=True)),
                ('capacitance_switch5', models.IntegerField(default=0, null=True)),
                ('capacitance_switch6', models.IntegerField(default=0, null=True)),
                ('capacitance_switch7', models.IntegerField(default=0, null=True)),
                ('capacitance_switch8', models.IntegerField(default=0, null=True)),
                ('capacitance_switch9', models.IntegerField(default=0, null=True)),
                ('capacitance_switch10', models.IntegerField(default=0, null=True)),
                ('capacitance_switch11', models.IntegerField(default=0, null=True)),
                ('capacitance_switch12', models.IntegerField(default=0, null=True)),
                ('capacitance_switch13', models.IntegerField(default=0, null=True)),
                ('capacitance_switch14', models.IntegerField(default=0, null=True)),
                ('capacitance_switch15', models.IntegerField(default=0, null=True)),
                ('capacitance_switch16', models.IntegerField(default=0, null=True)),
                ('capacitance_switch17', models.IntegerField(default=0, null=True)),
                ('capacitance_switch18', models.IntegerField(default=0, null=True)),
                ('power_switch1', models.IntegerField(default=0, null=True)),
                ('power_switch2', models.IntegerField(default=0, null=True)),
                ('power_switch3', models.IntegerField(default=0, null=True)),
                ('power_switch4', models.IntegerField(default=0, null=True)),
                ('power_switch5', models.IntegerField(default=0, null=True)),
                ('power_switch6', models.IntegerField(default=0, null=True)),
                ('power_switch7', models.IntegerField(default=0, null=True)),
                ('power_switch8', models.IntegerField(default=0, null=True)),
                ('power_switch9', models.IntegerField(default=0, null=True)),
                ('date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='DeviceInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('device_id', models.CharField(max_length=128, unique=True)),
                ('device_name', models.CharField(max_length=64)),
                ('device_desc', models.CharField(max_length=128)),
                ('longitude', models.FloatField()),
                ('latitude', models.FloatField()),
                ('address', models.CharField(max_length=256)),
                ('soft_version', models.CharField(max_length=64)),
                ('date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Register',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(max_length=64, unique=True)),
                ('password', models.CharField(blank=True, max_length=255, null=True)),
                ('prop', models.IntegerField(blank=True, choices=[(0, 'superAdmin'), (1, 'admin'), (2, 'user')], null=True)),
                ('name', models.CharField(blank=True, max_length=50, null=True)),
                ('sex', models.IntegerField(blank=True, choices=[(1, '男'), (2, '女')], null=True)),
                ('age', models.CharField(blank=True, max_length=10, null=True)),
                ('company', models.CharField(blank=True, max_length=50, null=True)),
                ('duty', models.CharField(blank=True, max_length=50, null=True)),
                ('phone', models.CharField(blank=True, max_length=11, null=True)),
                ('desc', models.CharField(blank=True, max_length=150, null=True)),
                ('date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='UserToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('token', models.CharField(max_length=64)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.Register')),
            ],
        ),
        migrations.CreateModel(
            name='Value',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('switch_set1', models.IntegerField(blank=True, null=True)),
                ('switch_set2', models.IntegerField(blank=True, null=True)),
                ('switch_set3', models.IntegerField(blank=True, null=True)),
                ('leakage_current_set1', models.FloatField(blank=True, null=True)),
                ('leakage_current_set2', models.FloatField(blank=True, null=True)),
                ('leakage_current_set3', models.FloatField(blank=True, null=True)),
                ('power_factor_set1', models.FloatField(blank=True, null=True)),
                ('switch_delay_set1', models.FloatField(blank=True, null=True)),
                ('ct_var_value', models.FloatField(blank=True, null=True)),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('device_id', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.DeviceInfo')),
            ],
        ),
        migrations.AddField(
            model_name='devicedata',
            name='device_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.DeviceInfo'),
        ),
        migrations.AddField(
            model_name='control',
            name='device_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.DeviceInfo'),
        ),
    ]
