# Generated by Django 3.0.2 on 2020-02-14 16:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Auth',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('permission_action', models.CharField(max_length=256)),
                ('remark', models.CharField(max_length=256, null=True)),
            ],
            options={
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='AuthCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('remark', models.CharField(max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='DataFrameFormat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('remark', models.CharField(max_length=256)),
            ],
        ),
        migrations.CreateModel(
            name='Dtu',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('remark', models.CharField(max_length=256)),
            ],
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('name', models.CharField(max_length=128, primary_key=True, serialize=False)),
                ('remark', models.CharField(max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('password', models.CharField(max_length=128)),
                ('phone', models.CharField(max_length=11)),
                ('email', models.EmailField(max_length=254)),
                ('create_time', models.DateTimeField()),
                ('state', models.CharField(default='enable', max_length=16)),
                ('remark', models.CharField(default='', max_length=256)),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Role')),
            ],
        ),
        migrations.CreateModel(
            name='RoleAuth',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('auth', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Auth')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Role')),
            ],
        ),
        migrations.AddField(
            model_name='role',
            name='authorities',
            field=models.ManyToManyField(through='flowmeter.RoleAuth', to='flowmeter.Auth'),
        ),
        migrations.CreateModel(
            name='Protocol',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('remark', models.CharField(max_length=256)),
                ('frame_format', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.DataFrameFormat')),
            ],
        ),
        migrations.CreateModel(
            name='NavigationBar',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('icon', models.CharField(default='', max_length=32)),
                ('name', models.CharField(max_length=64)),
                ('fid', models.IntegerField(default=-1)),
                ('order', models.IntegerField(default=0)),
                ('url', models.CharField(default='', max_length=128)),
                ('auth', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Auth')),
            ],
            options={
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='Meter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('address', models.IntegerField(default=-1)),
                ('last_update_time', models.DateTimeField()),
                ('surplus_gas', models.FloatField(default=-1)),
                ('valve_state', models.CharField(default='known', max_length=8)),
                ('recharge_state', models.CharField(default='known', max_length=8)),
                ('surplus_gas_limits', models.FloatField(default=-1)),
                ('flow_ratio', models.FloatField(default=-1)),
                ('state', models.CharField(default='known', max_length=8)),
                ('flow_rate', models.FloatField(default=-1)),
                ('total_flow', models.FloatField(default=-1)),
                ('temperature', models.FloatField(default=-1)),
                ('battery_pressure_state', models.CharField(default='known', max_length=8)),
                ('valve_error_flag', models.IntegerField(default=-1)),
                ('power', models.FloatField(default=-1)),
                ('owe_state', models.IntegerField(default=-1)),
                ('sensor_error_flag', models.IntegerField(default=-1)),
                ('version', models.FloatField(default=-1)),
                ('remark', models.CharField(max_length=256)),
                ('dtu', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Dtu')),
            ],
        ),
        migrations.CreateModel(
            name='DtuRegion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('left', models.IntegerField()),
                ('right', models.IntegerField()),
                ('manufacturer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.User')),
            ],
            options={
                'ordering': ['left'],
            },
        ),
        migrations.AddField(
            model_name='dtu',
            name='protocol',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.Protocol'),
        ),
        migrations.AddField(
            model_name='dtu',
            name='region',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.DtuRegion'),
        ),
        migrations.CreateModel(
            name='DataField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('begin_address', models.IntegerField()),
                ('end_address', models.IntegerField()),
                ('frame_format', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.DataFrameFormat')),
            ],
        ),
        migrations.AddField(
            model_name='auth',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flowmeter.AuthCategory'),
        ),
    ]
