# Generated by Django 3.1.4 on 2020-12-20 15:43

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Brew',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('batch_name', models.CharField(help_text='Batch name', max_length=50)),
                ('start_date', models.DateField(help_text='Date to start brewing')),
                ('total_quantity', models.PositiveIntegerField(blank=True, help_text='Quantity of beer obtained with this brew in liters', null=True)),
                ('mashing_water_quantity', models.FloatField(help_text='Liters of water to add during mashing')),
                ('brew_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the brewing stage')),
                ('brew_comments', models.TextField(blank=True, null=True)),
                ('filtration_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the filtration stage')),
                ('filtration_water_quantity', models.FloatField(help_text='Liters of waters to add during filtration')),
                ('boiling_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the boiling stage')),
                ('boiling_duration', models.IntegerField(help_text='Duration of boiling step in minutes')),
                ('whirlpool_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the whirlpool stage')),
                ('cooling_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the cooling stage')),
                ('cooling_end_time', models.DateTimeField(blank=True, null=True, verbose_name='End of the cooling stage')),
                ('fermentation_comments', models.TextField(blank=True, null=True)),
                ('adjuncts_start_time', models.DateTimeField(blank=True, null=True, verbose_name='Start of the adjuncts/dryhopping stage')),
            ],
        ),
        migrations.CreateModel(
            name='Ingredient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(choices=[('GRAIN', 'Grain'), ('HOP', 'Hop'), ('YEAST', 'Yeast'), ('ADJUNCT', 'Adjunct'), ('FRUIT', 'Fruit')], help_text='The type of ingredient', max_length=50)),
                ('variety', models.CharField(help_text='Name/variety of the ingredient', max_length=50)),
                ('unit', models.CharField(help_text='Unit of measure of the ingredient', max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='Recipe',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the recipe', max_length=50)),
                ('mashing_water_quantity', models.FloatField(help_text='Liters of water to add during mashing')),
                ('filtration_water_quantity', models.FloatField(help_text='Liters of waters to add during filtration')),
                ('boiling_duration', models.IntegerField(help_text='Duration of boiling step in minutes')),
            ],
        ),
        migrations.CreateModel(
            name='Supplier',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the supplier', max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Tank',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name/number of the tank', max_length=50, unique=True)),
                ('capacity', models.IntegerField(help_text='Capacity in liters')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeYeast',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the recipe')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
                ('yeast', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeWhirlpoolIngredient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the recipe')),
                ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeMashingIngredient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the recipe')),
                ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeFermentationStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the fermentation step', max_length=50)),
                ('temperature', models.FloatField(help_text='Temperature during this fermentation step')),
                ('duration', models.IntegerField(help_text='Duration of this fermentation step in days')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeBrewingStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('temperature', models.FloatField(help_text='Temperature during this brewing step')),
                ('duration', models.IntegerField(help_text='Duration of this brewing step in minutes')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeBoilingIngredient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the recipe')),
                ('time', models.IntegerField(help_text='When to add the ingredient (in minutes from the end of boiling)')),
                ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.CreateModel(
            name='RecipeAdjunct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the recipe')),
                ('day', models.IntegerField(help_text='Day to add the adjunct/hop (from the start of fermentation)')),
                ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.recipe')),
            ],
        ),
        migrations.AddField(
            model_name='recipe',
            name='adjuncts',
            field=models.ManyToManyField(help_text='Adjuncts/Hops to add during fermentation', related_name='recipe_adjuncts', through='brewbrew.RecipeAdjunct', to='brewbrew.Ingredient'),
        ),
        migrations.AddField(
            model_name='recipe',
            name='boiling_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during boiling', related_name='recipe_boiling', through='brewbrew.RecipeBoilingIngredient', to='brewbrew.Ingredient'),
        ),
        migrations.AddField(
            model_name='recipe',
            name='mashing_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during mashing', related_name='recipe_mashing', through='brewbrew.RecipeMashingIngredient', to='brewbrew.Ingredient'),
        ),
        migrations.AddField(
            model_name='recipe',
            name='whirlpool_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during whirlpool', related_name='recipe_whirlpool', through='brewbrew.RecipeWhirlpoolIngredient', to='brewbrew.Ingredient'),
        ),
        migrations.AddField(
            model_name='recipe',
            name='yeasts',
            field=models.ManyToManyField(help_text='Yeasts to add before fermentation', related_name='recipe_yeasts', through='brewbrew.RecipeYeast', to='brewbrew.Ingredient'),
        ),
        migrations.CreateModel(
            name='IngredientBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('batch_number', models.CharField(help_text='Batch number', max_length=50)),
                ('bill_number', models.CharField(help_text='Bill number', max_length=50)),
                ('quantity', models.FloatField(help_text='Quantity in the batch')),
                ('ingredient', models.ForeignKey(help_text='Ingredient', on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredient')),
            ],
        ),
        migrations.AddField(
            model_name='ingredient',
            name='supplier',
            field=models.ForeignKey(help_text='Supplier', on_delete=django.db.models.deletion.PROTECT, to='brewbrew.supplier'),
        ),
        migrations.CreateModel(
            name='BrewYeastBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the brew')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
                ('yeast_batch', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredientbatch')),
            ],
        ),
        migrations.CreateModel(
            name='BrewWhirlpoolIngredientBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the brew')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
                ('ingredient_batch', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredientbatch')),
            ],
        ),
        migrations.CreateModel(
            name='BrewMashingIngredientBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the brew')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
                ('ingredient_batch', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredientbatch')),
            ],
        ),
        migrations.CreateModel(
            name='BrewFermentationStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the fermentation step', max_length=50)),
                ('temperature', models.FloatField(help_text='Temperature during this fermentation step')),
                ('duration', models.IntegerField(help_text='Duration of this fermentation step in days')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
            ],
        ),
        migrations.CreateModel(
            name='BrewFermentationAnalysis',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day', models.IntegerField(help_text='Day number from the start of fermentation when the analysis occured')),
                ('plateau_degree_or_density', models.FloatField(help_text='Gravity expressed in °p or sg')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
            ],
        ),
        migrations.CreateModel(
            name='BrewBrewingStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('temperature', models.FloatField(help_text='Temperature during this brewing step')),
                ('duration', models.IntegerField(help_text='Duration of this brewing step in minutes')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
            ],
        ),
        migrations.CreateModel(
            name='BrewBoilingIngredientBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the brew')),
                ('time', models.IntegerField(help_text='When the ingredient was added (in minutes from the end of boiling)')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
                ('ingredient_batch', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredientbatch')),
            ],
        ),
        migrations.CreateModel(
            name='BrewAdjunctBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.FloatField(help_text='Quantity to use in the brew')),
                ('date', models.DateField(help_text='Date when the adjunct/hop was added')),
                ('brew', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brewbrew.brew')),
                ('ingredient_batch', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.ingredientbatch')),
            ],
        ),
        migrations.AddField(
            model_name='brew',
            name='adjuncts',
            field=models.ManyToManyField(help_text='Adjuncts/Hops to add during fermentation', related_name='brew_adjuncts', through='brewbrew.BrewAdjunctBatch', to='brewbrew.IngredientBatch'),
        ),
        migrations.AddField(
            model_name='brew',
            name='boiling_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during boiling', related_name='brew_boiling', through='brewbrew.BrewBoilingIngredientBatch', to='brewbrew.IngredientBatch'),
        ),
        migrations.AddField(
            model_name='brew',
            name='fermentation_tank',
            field=models.ForeignKey(help_text='Tank in which to ferment', on_delete=django.db.models.deletion.PROTECT, to='brewbrew.tank'),
        ),
        migrations.AddField(
            model_name='brew',
            name='mashing_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during mashing', related_name='brew_mashing', through='brewbrew.BrewMashingIngredientBatch', to='brewbrew.IngredientBatch'),
        ),
        migrations.AddField(
            model_name='brew',
            name='original_recipe',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='brewbrew.recipe'),
        ),
        migrations.AddField(
            model_name='brew',
            name='whirlpool_ingredients',
            field=models.ManyToManyField(help_text='Ingredients to add during whirlpool', related_name='brew_whirlpool', through='brewbrew.BrewWhirlpoolIngredientBatch', to='brewbrew.IngredientBatch'),
        ),
        migrations.AddField(
            model_name='brew',
            name='yeasts',
            field=models.ManyToManyField(help_text='Yeasts to add before fermentation', related_name='brew_yeasts', through='brewbrew.BrewYeastBatch', to='brewbrew.IngredientBatch'),
        ),
        migrations.AlterUniqueTogether(
            name='ingredient',
            unique_together={('type', 'variety')},
        ),
    ]
