# Generated by Django 3.0.5 on 2021-01-23 09:38

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='Book',
            fields=[
                ('bookID', models.IntegerField(blank=True, db_index=True, primary_key=True, serialize=False)),
                ('title', models.CharField(db_index=True, max_length=200)),
                ('authors', models.CharField(max_length=200)),
                ('average_rating', models.FloatField()),
                ('isbn', models.CharField(max_length=200)),
                ('language_code', models.CharField(max_length=200)),
                ('ratings_count', models.IntegerField()),
                ('price', models.FloatField()),
                ('image', models.CharField(max_length=1000)),
            ],
            options={
                'db_table': 'Books',
                'ordering': ('bookID',),
                'unique_together': {('bookID', 'title')},
            },
        ),
        migrations.CreateModel(
            name='CartBox',
            fields=[
                ('quantity', models.IntegerField(default=1)),
                ('box_id', models.AutoField(primary_key=True, serialize=False)),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='box', related_query_name='box', to='inventory.Book')),
            ],
            options={
                'db_table': 'cartbox',
            },
        ),
        migrations.CreateModel(
            name='Cart',
            fields=[
                ('cart_id', models.CharField(max_length=200, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('is_discarded', models.BooleanField(default=False)),
                ('is_checked_out', models.BooleanField(default=False)),
                ('total', models.FloatField()),
                ('billed_at', models.DateTimeField()),
                ('box', models.ManyToManyField(related_name='cart', related_query_name='cart', to='inventory.CartBox')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'cart',
                'ordering': ('-created_at',),
            },
        ),
    ]
