# Generated by Django 3.2.10 on 2021-12-25 19:08

from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='email address')),
                ('name', models.CharField(blank=True, default='', max_length=256)),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='BnPElement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tlg_element_id', models.PositiveIntegerField()),
                ('image_url', models.URLField(default='', max_length=512)),
                ('last_updated', models.DateTimeField(default=django.utils.timezone.now)),
                ('sold_out', models.BooleanField(default=False)),
                ('available', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ('-last_updated',),
            },
        ),
        migrations.CreateModel(
            name='BricklinkCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bl_id', models.PositiveIntegerField()),
                ('name', models.CharField(max_length=256)),
            ],
        ),
        migrations.CreateModel(
            name='CatalogItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item_type', models.CharField(choices=[('set', 'Set'), ('part', 'Part'), ('minifig', 'Minifig'), ('gear', 'Gear'), ('book', 'Book'), ('bricklink_order', 'Bricklink order'), ('lugbulk_order', 'Lugbulk order'), ('bulklot', 'Bulk lot')], default='part', max_length=16)),
                ('name', models.CharField(max_length=256)),
                ('number', models.CharField(max_length=32)),
                ('no_inventory', models.BooleanField(default=False)),
                ('year_released', models.PositiveIntegerField(blank=True, null=True)),
                ('weight', models.DecimalField(blank=True, decimal_places=4, max_digits=9, null=True)),
                ('dimensions', models.CharField(blank=True, max_length=64, null=True)),
                ('bl_id', models.PositiveIntegerField(blank=True, default=0, null=True)),
                ('brickset_id', models.CharField(blank=True, default='', max_length=32)),
                ('tlg_number', models.PositiveIntegerField(null=True)),
                ('tlg_name', models.CharField(blank=True, default='', max_length=256)),
                ('other_names', models.JSONField(default=list)),
                ('other_numbers', models.JSONField(default=list)),
            ],
        ),
        migrations.CreateModel(
            name='Colour',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('number', models.PositiveIntegerField()),
                ('slug', models.SlugField(default='', editable=False, max_length=64)),
                ('tlg_name', models.CharField(blank=True, default='', max_length=256)),
                ('tlg_number', models.PositiveIntegerField(blank=True, null=True)),
                ('ldraw_name', models.CharField(blank=True, default='', max_length=256)),
                ('ldraw_number', models.PositiveIntegerField(blank=True, null=True)),
                ('other_names', models.JSONField(default=list)),
            ],
        ),
        migrations.CreateModel(
            name='Element',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lego_ids', models.JSONField(default=list)),
                ('colour', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='elements', to='brixdb.colour')),
            ],
        ),
        migrations.CreateModel(
            name='Minifig',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('name',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='Part',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('name',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='Set',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('number',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='OwnedItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owners', to='brixdb.catalogitem')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_items', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ItemInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1)),
                ('is_extra', models.BooleanField(default=False)),
                ('is_counterpart', models.BooleanField(default=False)),
                ('is_alternate', models.BooleanField(default=False)),
                ('match_id', models.PositiveIntegerField(blank=True, default=0)),
                ('element', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='part_of', to='brixdb.element')),
                ('item', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='part_of', to='brixdb.catalogitem')),
                ('part_of', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inventory', to='brixdb.catalogitem')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('slug', models.SlugField(default='', max_length=64)),
                ('bl_id', models.CharField(max_length=64)),
                ('bl_category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='brixdb.bricklinkcategory')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sub_categories', to='brixdb.category')),
            ],
        ),
        migrations.AddField(
            model_name='catalogitem',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='brixdb.category'),
        ),
        migrations.AddField(
            model_name='catalogitem',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_brixdb.catalogitem_set+', to='contenttypes.contenttype'),
        ),
        migrations.CreateModel(
            name='BnPElementPrices',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_seen', models.DateTimeField(default=django.utils.timezone.now)),
                ('currency', models.CharField(max_length=3)),
                ('price', models.DecimalField(decimal_places=2, max_digits=9)),
                ('element', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prices', to='brixdb.bnpelement')),
            ],
        ),
        migrations.AddField(
            model_name='bnpelement',
            name='element',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bnp_elements', to='brixdb.element'),
        ),
        migrations.CreateModel(
            name='LugbulkOrder',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('period', models.CharField(max_length=8)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lugbulk_orders', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('period', 'owner'),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.AddField(
            model_name='element',
            name='part',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='elements', to='brixdb.part'),
        ),
        migrations.AlterUniqueTogether(
            name='catalogitem',
            unique_together={('item_type', 'number')},
        ),
        migrations.CreateModel(
            name='BulkLot',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('acquired', models.DateTimeField(blank=True, null=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bulk_lots', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('name', 'owner'),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='BricklinkOrder',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('ordered', models.DateTimeField(blank=True, null=True)),
                ('seller_username', models.CharField(blank=True, default='', max_length=256)),
                ('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('shipping', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('fees', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('currency', models.CharField(blank=True, default='', max_length=3)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bricklink_orders', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('number',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.AlterUniqueTogether(
            name='element',
            unique_together={('part', 'colour')},
        ),
    ]

# Generated by Django 3.2.10 on 2021-12-25 19:08

from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='email address')),
                ('name', models.CharField(blank=True, default='', max_length=256)),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='BnPElement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tlg_element_id', models.PositiveIntegerField()),
                ('image_url', models.URLField(default='', max_length=512)),
                ('last_updated', models.DateTimeField(default=django.utils.timezone.now)),
                ('sold_out', models.BooleanField(default=False)),
                ('available', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ('-last_updated',),
            },
        ),
        migrations.CreateModel(
            name='BricklinkCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bl_id', models.PositiveIntegerField()),
                ('name', models.CharField(max_length=256)),
            ],
        ),
        migrations.CreateModel(
            name='CatalogItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item_type', models.CharField(choices=[('set', 'Set'), ('part', 'Part'), ('minifig', 'Minifig'), ('gear', 'Gear'), ('book', 'Book'), ('bricklink_order', 'Bricklink order'), ('lugbulk_order', 'Lugbulk order'), ('bulklot', 'Bulk lot')], default='part', max_length=16)),
                ('name', models.CharField(max_length=256)),
                ('number', models.CharField(max_length=32)),
                ('no_inventory', models.BooleanField(default=False)),
                ('year_released', models.PositiveIntegerField(blank=True, null=True)),
                ('weight', models.DecimalField(blank=True, decimal_places=4, max_digits=9, null=True)),
                ('dimensions', models.CharField(blank=True, max_length=64, null=True)),
                ('bl_id', models.PositiveIntegerField(blank=True, default=0, null=True)),
                ('brickset_id', models.CharField(blank=True, default='', max_length=32)),
                ('tlg_number', models.PositiveIntegerField(null=True)),
                ('tlg_name', models.CharField(blank=True, default='', max_length=256)),
                ('other_names', models.JSONField(default=list)),
                ('other_numbers', models.JSONField(default=list)),
            ],
        ),
        migrations.CreateModel(
            name='Colour',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('number', models.PositiveIntegerField()),
                ('slug', models.SlugField(default='', editable=False, max_length=64)),
                ('tlg_name', models.CharField(blank=True, default='', max_length=256)),
                ('tlg_number', models.PositiveIntegerField(blank=True, null=True)),
                ('ldraw_name', models.CharField(blank=True, default='', max_length=256)),
                ('ldraw_number', models.PositiveIntegerField(blank=True, null=True)),
                ('other_names', models.JSONField(default=list)),
            ],
        ),
        migrations.CreateModel(
            name='Element',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lego_ids', models.JSONField(default=list)),
                ('colour', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='elements', to='brixdb.colour')),
            ],
        ),
        migrations.CreateModel(
            name='Minifig',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('name',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='Part',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('name',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='Set',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
            ],
            options={
                'ordering': ('number',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='OwnedItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owners', to='brixdb.catalogitem')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_items', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ItemInventory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(default=1)),
                ('is_extra', models.BooleanField(default=False)),
                ('is_counterpart', models.BooleanField(default=False)),
                ('is_alternate', models.BooleanField(default=False)),
                ('match_id', models.PositiveIntegerField(blank=True, default=0)),
                ('element', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='part_of', to='brixdb.element')),
                ('item', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='part_of', to='brixdb.catalogitem')),
                ('part_of', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inventory', to='brixdb.catalogitem')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('slug', models.SlugField(default='', max_length=64)),
                ('bl_id', models.CharField(max_length=64)),
                ('bl_category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='brixdb.bricklinkcategory')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sub_categories', to='brixdb.category')),
            ],
        ),
        migrations.AddField(
            model_name='catalogitem',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='brixdb.category'),
        ),
        migrations.AddField(
            model_name='catalogitem',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_brixdb.catalogitem_set+', to='contenttypes.contenttype'),
        ),
        migrations.CreateModel(
            name='BnPElementPrices',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_seen', models.DateTimeField(default=django.utils.timezone.now)),
                ('currency', models.CharField(max_length=3)),
                ('price', models.DecimalField(decimal_places=2, max_digits=9)),
                ('element', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prices', to='brixdb.bnpelement')),
            ],
        ),
        migrations.AddField(
            model_name='bnpelement',
            name='element',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bnp_elements', to='brixdb.element'),
        ),
        migrations.CreateModel(
            name='LugbulkOrder',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('period', models.CharField(max_length=8)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lugbulk_orders', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('period', 'owner'),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.AddField(
            model_name='element',
            name='part',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='elements', to='brixdb.part'),
        ),
        migrations.AlterUniqueTogether(
            name='catalogitem',
            unique_together={('item_type', 'number')},
        ),
        migrations.CreateModel(
            name='BulkLot',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('acquired', models.DateTimeField(blank=True, null=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bulk_lots', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('name', 'owner'),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.CreateModel(
            name='BricklinkOrder',
            fields=[
                ('catalogitem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='brixdb.catalogitem')),
                ('ordered', models.DateTimeField(blank=True, null=True)),
                ('seller_username', models.CharField(blank=True, default='', max_length=256)),
                ('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('shipping', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('fees', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('currency', models.CharField(blank=True, default='', max_length=3)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bricklink_orders', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('number',),
            },
            bases=('brixdb.catalogitem',),
        ),
        migrations.AlterUniqueTogether(
            name='element',
            unique_together={('part', 'colour')},
        ),
    ]

# Generated by Django 3.2.10 on 2021-12-25 19:08