# Generated by Django 3.0.1 on 2020-01-07 10:57

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CardboardWish',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('cardboard_name', models.CharField(max_length=255)),
                ('minimum_amount', models.PositiveSmallIntegerField(default=1)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='WishList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_at', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Wish',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('weight', models.PositiveSmallIntegerField(default=1)),
                ('wish_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wishes', to='wishlist.WishList')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Requirement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(choices=[('wishlist.fromexpansions', 'from expansions'), ('wishlist.isborder', 'is border'), ('wishlist.isminimumcondition', 'is minimum condition'), ('wishlist.islanguage', 'is language'), ('wishlist.isfoil', 'is foil'), ('wishlist.isaltered', 'is altered'), ('wishlist.issigned', 'is signed')], db_index=True, max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('border', utils.fields.EnumField(enum_type='mtgorp.models.persistent.attributes.borders.Border', null=True)),
                ('condition', utils.fields.EnumField(enum_type='wishlist.values.Condition', null=True)),
                ('language', utils.fields.EnumField(enum_type='wishlist.values.Language', null=True)),
                ('is_foil', models.BooleanField(null=True)),
                ('is_altered', models.BooleanField(null=True)),
                ('is_signed', models.BooleanField(null=True)),
                ('cardboard_wish', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requirements', to='wishlist.CardboardWish')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='cardboardwish',
            name='wish',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cardboard_wishes', to='wishlist.Wish'),
        ),
        migrations.CreateModel(
            name='FromExpansions',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsAltered',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsBorder',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsFoil',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsLanguage',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsMinimumCondition',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='IsSigned',
            fields=[
            ],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('wishlist.requirement',),
        ),
        migrations.CreateModel(
            name='ExpansionCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=7)),
                ('requirement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expansion_codes', to='wishlist.FromExpansions')),
            ],
        ),

        migrations.RunSQL(
            """
            alter table wishlist_requirement
            add constraint cardboard_wish_id
            foreign key (cardboard_wish_id)
            REFERENCES wishlist_cardboardwish(id)
            on delete cascade;
            """
        ),
    ]
