# Generated by Django 3.1.4 on 2020-12-22 22:09

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Container',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Distributor',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('web_link', models.URLField(blank=True, null=True)),
                ('search_link', models.URLField(blank=True,
                 help_text='Use {} for search placeholder', null=True)),
                ('phone', models.CharField(blank=True, max_length=128, null=True)),
                ('email', models.EmailField(blank=True,
                 default=None, max_length=254, null=True)),
                ('icon', models.ImageField(blank=True, null=True, upload_to='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Documentation',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('file', models.FileField(upload_to='')),
            ],
        ),
        migrations.CreateModel(
            name='FormFactor',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('icon', models.ImageField(blank=True, null=True, upload_to='')),
                ('datasheet', models.FileField(blank=True, null=True, upload_to='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Layout',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('data', models.JSONField()),
                ('template_name', models.CharField(
                    blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Settings',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('default_container', models.ForeignKey(blank=True, default=None,
                 help_text='Default container to display when calling the index page',
                 null=True, on_delete=django.db.models.deletion.SET_NULL, to='inventory.container')),
            ],
            options={
                'verbose_name_plural': 'Settings',
            },
        ),
        migrations.CreateModel(
            name='Manufacturer',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(blank=True, max_length=4096)),
                ('web_link', models.URLField(blank=True, null=True)),
                ('icon', models.ImageField(blank=True, null=True, upload_to='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('tags', models.ManyToManyField(blank=True, to='inventory.Tag')),
            ],
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True,
                 primary_key=True, serialize=False, verbose_name='ID')),
                ('index', models.PositiveIntegerField(
                    verbose_name='Index of compartment in layout')),
                ('name', models.TextField(max_length=255)),
                ('description', models.CharField(max_length=4096)),
                ('size', models.PositiveIntegerField(default=1,
                 help_text='Number of sub-compartments this item takes up')),
                ('distributor_item_no', models.CharField(
                    blank=True, max_length=255, null=True)),
                ('price', models.DecimalField(blank=True,
                 decimal_places=3, max_digits=7, null=True)),
                ('last_ordered_on', models.DateField(blank=True, null=True)),
                ('metadata', models.JSONField(blank=True, null=True,
                 verbose_name='Custom metadata, used by templates')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('container', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE,
                 related_name='item_related', to='inventory.container')),
                ('distributor', models.ForeignKey(blank=True, null=True,
                 on_delete=django.db.models.deletion.PROTECT, to='inventory.distributor')),
                ('documentation', models.ManyToManyField(blank=True,
                 related_name='items', to='inventory.Documentation')),
                ('form_factor', models.ForeignKey(blank=True, null=True,
                 on_delete=django.db.models.deletion.PROTECT, to='inventory.formfactor')),
                ('manufacturer', models.ForeignKey(blank=True, null=True,
                 on_delete=django.db.models.deletion.PROTECT, to='inventory.manufacturer')),
                ('tags', models.ManyToManyField(blank=True, to='inventory.Tag')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='formfactor',
            name='tags',
            field=models.ManyToManyField(blank=True, to='inventory.Tag'),
        ),
        migrations.AddField(
            model_name='distributor',
            name='tags',
            field=models.ManyToManyField(blank=True, to='inventory.Tag'),
        ),
        migrations.AddField(
            model_name='container',
            name='layout',
            field=models.ForeignKey(
                blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='inventory.layout'),
        ),
        migrations.CreateModel(
            name='Workshop',
            fields=[
                ('container_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
                 parent_link=True, primary_key=True, serialize=False, to='inventory.container')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('show_boxes', models.BooleanField(
                    default=True, help_text='Allow boxes to be defined directly in this workshop')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('tags', models.ManyToManyField(blank=True, to='inventory.Tag')),
            ],
            bases=('inventory.container',),
        ),
        migrations.CreateModel(
            name='Box',
            fields=[
                ('container_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
                 parent_link=True, primary_key=True, serialize=False, to='inventory.container')),
                ('index', models.PositiveIntegerField(
                    verbose_name='Index of compartment in layout')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('container', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE,
                 related_name='box_related', to='inventory.container')),
                ('tags', models.ManyToManyField(blank=True, to='inventory.Tag')),
            ],
            options={
                'verbose_name_plural': 'Boxes',
            },
            bases=('inventory.container', models.Model),
        ),
        migrations.CreateModel(
            name='Area',
            fields=[
                ('container_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
                 parent_link=True, primary_key=True, serialize=False, to='inventory.container')),
                ('index', models.PositiveIntegerField(
                    verbose_name='Index of compartment in layout')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=4096)),
                ('show_sub_area', models.BooleanField(default=True,
                 help_text='Allow sub-areas to be defined in this area')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('changed_at', models.DateTimeField(auto_now=True)),
                ('container', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE,
                 related_name='area_related', to='inventory.container')),
            ],
            options={
                'abstract': False,
            },
            bases=('inventory.container', models.Model),
        ),
    ]
