# Generated by Django 3.0.6 on 2020-05-27 20:43

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
            ],
            options={
                'verbose_name': 'Тип',
                'verbose_name_plural': 'Тип оборудования',
            },
        ),
        migrations.CreateModel(
            name='CrashList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time_start', models.TimeField()),
                ('time_stop', models.TimeField(blank=True, null=True)),
                ('text', models.TextField()),
                ('status', models.CharField(blank=True, max_length=200)),
                ('comment', models.TextField(blank=True)),
            ],
            options={
                'verbose_name': 'Авария (вызов персонала)',
                'verbose_name_plural': 'Аварии (вызов персонала)',
            },
        ),
        migrations.CreateModel(
            name='Day',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day', models.DateField()),
            ],
            options={
                'verbose_name': 'Дата',
                'verbose_name_plural': 'Даты',
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=120)),
            ],
            options={
                'verbose_name': 'Участок',
                'verbose_name_plural': 'Участки',
            },
        ),
        migrations.CreateModel(
            name='Machine',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=120)),
                ('comment', models.CharField(blank=True, max_length=120)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machines', to='machines.Category')),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machines', to='machines.Location')),
            ],
            options={
                'verbose_name': 'Оборудование',
                'verbose_name_plural': 'Оборудования',
            },
        ),
        migrations.CreateModel(
            name='ServiceName',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Сервисную службу',
                'verbose_name_plural': 'Службы',
            },
        ),
        migrations.CreateModel(
            name='ServiceStopTimeList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.ServiceName')),
            ],
        ),
        migrations.CreateModel(
            name='ServiceToDoList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.ServiceName')),
            ],
        ),
        migrations.CreateModel(
            name='Value',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day', models.DateField()),
                ('value', models.TextField(default='[]')),
                ('status', models.TextField(default='[]')),
                ('machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='values', to='machines.Machine')),
            ],
            options={
                'verbose_name': 'Значение',
                'verbose_name_plural': 'Значения',
            },
        ),
        migrations.CreateModel(
            name='ToDoList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time_start', models.TimeField()),
                ('time_stop', models.TimeField(blank=True, null=True)),
                ('text', models.TextField()),
                ('status', models.CharField(blank=True, max_length=200)),
                ('comment', models.TextField(blank=True)),
                ('day_start', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, related_name='todo_list', to='machines.Day')),
                ('day_stop', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Day')),
                ('machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machine_todo_list', to='machines.Machine')),
                ('services', models.ManyToManyField(through='machines.ServiceToDoList', to='machines.ServiceName')),
            ],
            options={
                'verbose_name': 'Выполненная работа (сменный журнал)',
                'verbose_name_plural': 'Выполненные работы (сменный журнал)',
            },
        ),
        migrations.CreateModel(
            name='StopTimeList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time_start', models.TimeField()),
                ('time_stop', models.TimeField(blank=True, null=True)),
                ('text', models.TextField()),
                ('status', models.CharField(blank=True, max_length=200)),
                ('comment', models.TextField(blank=True)),
                ('day_start', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stop_time_list', to='machines.Day')),
                ('day_stop', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Day')),
                ('machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machine_stop_time_list', to='machines.Machine')),
                ('services', models.ManyToManyField(related_name='services_stop_time_list', through='machines.ServiceStopTimeList', to='machines.ServiceName')),
            ],
            options={
                'verbose_name': 'Простой оборудования',
                'verbose_name_plural': 'Ведомость простоев',
            },
        ),
        migrations.AddField(
            model_name='servicetodolist',
            name='todo_list',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.ToDoList'),
        ),
        migrations.AddField(
            model_name='servicestoptimelist',
            name='stop_time_list',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.StopTimeList'),
        ),
        migrations.CreateModel(
            name='ServiceCrashList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('crash_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.CrashList')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.ServiceName')),
            ],
        ),
        migrations.AddField(
            model_name='crashlist',
            name='day_start',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='crash_list', to='machines.Day'),
        ),
        migrations.AddField(
            model_name='crashlist',
            name='day_stop',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Day'),
        ),
        migrations.AddField(
            model_name='crashlist',
            name='machine',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machine_crash_lists', to='machines.Machine'),
        ),
        migrations.AddField(
            model_name='crashlist',
            name='services',
            field=models.ManyToManyField(through='machines.ServiceCrashList', to='machines.ServiceName'),
        ),
    ]
