# Generated by Django 3.0.3 on 2020-02-25 11:22

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('deleted', models.DateTimeField(blank=True, default=None, help_text='The date and time when the object was deleted', null=True, verbose_name='date of deletion')),
                ('name', models.CharField(max_length=200)),
                ('code', models.CharField(blank=True, max_length=20, verbose_name='item code')),
                ('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
            ],
            options={
                'db_table': 'item',
            },
        ),
        migrations.CreateModel(
            name='ShoppingList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_created=True, verbose_name='creation date')),
                ('deleted', models.DateTimeField(blank=True, default=None, help_text='The date and time when the object was deleted', null=True, verbose_name='date of deletion')),
                ('name', models.CharField(blank=True, max_length=100)),
            ],
            options={
                'db_table': 'shopping_list',
            },
        ),
        migrations.CreateModel(
            name='ShoppingListItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('deleted', models.DateTimeField(blank=True, default=None, help_text='The date and time when the object was deleted', null=True, verbose_name='date of deletion')),
                ('is_done', models.BooleanField(default=False)),
                ('quantity', models.PositiveSmallIntegerField(default=1)),
                ('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='creator', to=settings.AUTH_USER_MODEL)),
                ('editor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='editor', to=settings.AUTH_USER_MODEL)),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shopping_list.Item')),
                ('shopping_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shopping_list.ShoppingList')),
            ],
            options={
                'db_table': 'shopping_list_item',
            },
        ),
        migrations.AddField(
            model_name='shoppinglist',
            name='items',
            field=models.ManyToManyField(through='shopping_list.ShoppingListItem', to='shopping_list.Item'),
        ),
        migrations.AddField(
            model_name='shoppinglist',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='SharedShoppingList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('deleted', models.DateTimeField(blank=True, default=None, help_text='The date and time when the object was deleted', null=True, verbose_name='date of deletion')),
                ('shopping_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shopping_list.ShoppingList')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'shared_shopping_list',
            },
        ),
    ]
