# Generated by Django 2.2.3 on 2019-07-19 13:04

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Comp',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('serial_number', models.CharField(default=None, max_length=200, unique=True)),
            ],
            options={
                'verbose_name': 'Машина',
                'verbose_name_plural': 'Машины',
            },
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('country', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Страна произвоздства',
                'verbose_name_plural': 'Страны производства',
            },
        ),
        migrations.CreateModel(
            name='Part',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('part_name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Партия',
                'verbose_name_plural': 'Партии',
            },
        ),
        migrations.CreateModel(
            name='TypeComponents',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_type', models.CharField(max_length=200, verbose_name='Тип')),
            ],
            options={
                'verbose_name': 'Тип ПКИ',
                'verbose_name_plural': 'Типы ПКИ',
            },
        ),
        migrations.CreateModel(
            name='Pki',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=200, verbose_name='Наименование')),
                ('serial_number', models.CharField(max_length=255, unique=True, verbose_name='Серийный номер')),
                ('date_of_arrival', models.DateTimeField(auto_now_add=True, verbose_name='Дата')),
                ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='app74.Country', verbose_name='Страна производства')),
                ('name_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app74.TypeComponents', verbose_name='Тип')),
                ('part_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app74.Part', verbose_name='Партия')),
            ],
            options={
                'verbose_name': 'ПКИ',
                'verbose_name_plural': 'ПКИ',
            },
        ),
        migrations.CreateModel(
            name='CompItems',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.IntegerField(default=1)),
                ('comp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app74.Comp', verbose_name='Серийный номер машины')),
                ('items', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app74.TypeComponents', verbose_name='Тип')),
            ],
            options={
                'verbose_name': 'Состав машины',
                'verbose_name_plural': 'Составы машин',
            },
        ),
        migrations.AddField(
            model_name='comp',
            name='items',
            field=models.ManyToManyField(related_name='all_items', through='app74.CompItems', to='app74.TypeComponents'),
        ),
        migrations.AddField(
            model_name='comp',
            name='part',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='app74.Part'),
        ),
    ]
