# Generated by Django 3.2.5 on 2021-08-13 15:53

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('MaterialModel', '0015_auto_20210813_1548'),
    ]

    operations = [
        migrations.CreateModel(
            name='Input_Recipe_Material',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('count', models.IntegerField(verbose_name='数量')),
            ],
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('material_id', models.IntegerField(unique=True, verbose_name='物资id')),
                ('name', models.CharField(max_length=20, unique=True, verbose_name='物资名')),
            ],
        ),
        migrations.CreateModel(
            name='MaterialDetail',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('productivity', models.FloatField(verbose_name='物资自身产能')),
                ('level', models.SmallIntegerField(choices=[(1, 'Q1'), (2, 'Q2'), (3, 'Q3')], default=1, verbose_name='物资等级')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.material', verbose_name='物资')),
            ],
            options={
                'unique_together': {('material', 'level')},
            },
        ),
        migrations.CreateModel(
            name='Output_Recipe_Material',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('count', models.IntegerField(verbose_name='数量')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.materialdetail', verbose_name='物资')),
            ],
        ),
        migrations.CreateModel(
            name='Recipe',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('input', models.ManyToManyField(related_name='input', through='MaterialModel.Input_Recipe_Material', to='MaterialModel.MaterialDetail', verbose_name='输入')),
                ('output', models.ManyToManyField(related_name='output', through='MaterialModel.Output_Recipe_Material', to='MaterialModel.MaterialDetail', verbose_name='输出')),
            ],
        ),
        migrations.AddField(
            model_name='output_recipe_material',
            name='recipe',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.recipe', verbose_name='配方'),
        ),
        migrations.AddField(
            model_name='input_recipe_material',
            name='material',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.materialdetail', verbose_name='输入物资'),
        ),
        migrations.AddField(
            model_name='input_recipe_material',
            name='recipe',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.recipe', verbose_name='配方'),
        ),
        migrations.CreateModel(
            name='UserMaterial',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('count', models.FloatField(verbose_name='拥有数量')),
                ('material_detail', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='MaterialModel.materialdetail', verbose_name='物资详情')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
            ],
            options={
                'unique_together': {('user', 'material_detail')},
            },
        ),
    ]
