<reponame>apaxson/batchthis
# Generated by Django 3.0.3 on 2020-03-26 01:35

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Batch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('startdate', models.DateTimeField(auto_now=True)),
                ('enddate', models.DateTimeField(blank=True, null=True)),
                ('size', models.IntegerField()),
                ('active', models.BooleanField(default=True)),
                ('startingGravity', models.FloatField()),
                ('estimatedEndGravity', models.FloatField()),
            ],
            options={
                'verbose_name_plural': 'batches',
            },
        ),
        migrations.CreateModel(
            name='BatchAdditionItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of this addition item.', max_length=50)),
                ('maker', models.CharField(blank=True, help_text='Name of the company who made this item.', max_length=50)),
                ('lotid', models.CharField(blank=True, help_text='The lot or batch id of this item.  Useful when looking for batches made with bad Lot', max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='BatchNoteType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='BatchStyle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='BatchTestType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25)),
                ('shortid', models.SlugField(unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(help_text="Enter the unit identifier, i.e. 'mgL' or 'ph'", max_length=10)),
                ('label', models.CharField(help_text="Enter abbreviation label of the measured unit, i.e. 'mg/L'", max_length=25, null=True)),
                ('name', models.CharField(help_text='Descriptive Name of the measuring unit.', max_length=25, null=True)),
                ('category', models.SmallIntegerField(choices=[(0, 'Temperature'), (1, 'Concentration/Density'), (2, 'Weight/Mass'), (3, 'pH'), (4, 'Timing'), (5, 'Volume')])),
            ],
        ),
        migrations.CreateModel(
            name='Fermenter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25)),
                ('max_size', models.IntegerField()),
                ('used_size', models.IntegerField(blank=True, null=True)),
                ('status', models.CharField(default='Clean/Ready', max_length=15)),
                ('max_size_units', models.ForeignKey(on_delete=models.SET('_del'), related_name='fermenter_max_size_units', to='batchthis.Unit')),
                ('used_size_units', models.ForeignKey(blank=True, null=True, on_delete=models.SET('_del'), related_name='fermenter_used_size_units', to='batchthis.Unit')),
            ],
        ),
        migrations.CreateModel(
            name='BatchTest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('datetime', models.DateTimeField(auto_now=True)),
                ('value', models.FloatField()),
                ('description', models.CharField(blank=True, max_length=250)),
                ('batch', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests', to='batchthis.Batch')),
                ('type', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchTestType')),
                ('units', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit')),
            ],
        ),
        migrations.CreateModel(
            name='BatchNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='batchthis.Batch')),
                ('notetype', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchNoteType')),
            ],
        ),
        migrations.CreateModel(
            name='BatchCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('bjcp_code', models.CharField(max_length=3)),
                ('style', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='batchthis.BatchStyle')),
            ],
            options={
                'verbose_name_plural': 'batch categories',
            },
        ),
        migrations.CreateModel(
            name='BatchAddition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, help_text='Add a brief description of this Addition item and why', max_length=250)),
                ('amount', models.FloatField()),
                ('batch', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='additions', to='batchthis.Batch')),
                ('name', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchAdditionItem')),
                ('units', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit')),
            ],
        ),
        migrations.AddField(
            model_name='batch',
            name='category',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.SET('_del'), to='batchthis.BatchCategory'),
        ),
        migrations.AddField(
            model_name='batch',
            name='fermenter',
            field=models.ManyToManyField(blank=True, related_name='batch', to='batchthis.Fermenter'),
        ),
        migrations.AddField(
            model_name='batch',
            name='size_units',
            field=models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit'),
        ),
    ]

# Generated by Django 3.0.3 on 2020-03-26 01:35

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Batch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('startdate', models.DateTimeField(auto_now=True)),
                ('enddate', models.DateTimeField(blank=True, null=True)),
                ('size', models.IntegerField()),
                ('active', models.BooleanField(default=True)),
                ('startingGravity', models.FloatField()),
                ('estimatedEndGravity', models.FloatField()),
            ],
            options={
                'verbose_name_plural': 'batches',
            },
        ),
        migrations.CreateModel(
            name='BatchAdditionItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of this addition item.', max_length=50)),
                ('maker', models.CharField(blank=True, help_text='Name of the company who made this item.', max_length=50)),
                ('lotid', models.CharField(blank=True, help_text='The lot or batch id of this item.  Useful when looking for batches made with bad Lot', max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='BatchNoteType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='BatchStyle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='BatchTestType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25)),
                ('shortid', models.SlugField(unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(help_text="Enter the unit identifier, i.e. 'mgL' or 'ph'", max_length=10)),
                ('label', models.CharField(help_text="Enter abbreviation label of the measured unit, i.e. 'mg/L'", max_length=25, null=True)),
                ('name', models.CharField(help_text='Descriptive Name of the measuring unit.', max_length=25, null=True)),
                ('category', models.SmallIntegerField(choices=[(0, 'Temperature'), (1, 'Concentration/Density'), (2, 'Weight/Mass'), (3, 'pH'), (4, 'Timing'), (5, 'Volume')])),
            ],
        ),
        migrations.CreateModel(
            name='Fermenter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25)),
                ('max_size', models.IntegerField()),
                ('used_size', models.IntegerField(blank=True, null=True)),
                ('status', models.CharField(default='Clean/Ready', max_length=15)),
                ('max_size_units', models.ForeignKey(on_delete=models.SET('_del'), related_name='fermenter_max_size_units', to='batchthis.Unit')),
                ('used_size_units', models.ForeignKey(blank=True, null=True, on_delete=models.SET('_del'), related_name='fermenter_used_size_units', to='batchthis.Unit')),
            ],
        ),
        migrations.CreateModel(
            name='BatchTest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('datetime', models.DateTimeField(auto_now=True)),
                ('value', models.FloatField()),
                ('description', models.CharField(blank=True, max_length=250)),
                ('batch', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests', to='batchthis.Batch')),
                ('type', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchTestType')),
                ('units', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit')),
            ],
        ),
        migrations.CreateModel(
            name='BatchNote',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='batchthis.Batch')),
                ('notetype', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchNoteType')),
            ],
        ),
        migrations.CreateModel(
            name='BatchCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('bjcp_code', models.CharField(max_length=3)),
                ('style', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='batchthis.BatchStyle')),
            ],
            options={
                'verbose_name_plural': 'batch categories',
            },
        ),
        migrations.CreateModel(
            name='BatchAddition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, help_text='Add a brief description of this Addition item and why', max_length=250)),
                ('amount', models.FloatField()),
                ('batch', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='additions', to='batchthis.Batch')),
                ('name', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.BatchAdditionItem')),
                ('units', models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit')),
            ],
        ),
        migrations.AddField(
            model_name='batch',
            name='category',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.SET('_del'), to='batchthis.BatchCategory'),
        ),
        migrations.AddField(
            model_name='batch',
            name='fermenter',
            field=models.ManyToManyField(blank=True, related_name='batch', to='batchthis.Fermenter'),
        ),
        migrations.AddField(
            model_name='batch',
            name='size_units',
            field=models.ForeignKey(on_delete=models.SET('_del'), to='batchthis.Unit'),
        ),
    ]
# Generated by Django 3.0.3 on 2020-03-26 01:35