# Generated by Django 3.1.6 on 2021-02-11 08:13

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='Bookcase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=254, verbose_name='Bookcase name')),
                ('user', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Bookcase',
                'verbose_name_plural': 'Bookcases',
                'ordering': ('-id',),
                'unique_together': {('user', 'name')},
            },
        ),
        migrations.CreateModel(
            name='BookcaseSlot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bookshelf_number', models.PositiveIntegerField(verbose_name='Bookshelf number')),
                ('number', models.PositiveIntegerField(verbose_name='Slot number')),
                ('bookcase', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='slots', to='viewer.bookcase', verbose_name='Bookcase')),
            ],
            options={
                'verbose_name': 'Bookcase slot',
                'verbose_name_plural': 'Bookcase slots',
                'ordering': ('-id',),
                'unique_together': {('bookcase', 'bookshelf_number', 'number')},
            },
        ),
        migrations.CreateModel(
            name='BookAuthor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('firstname', models.CharField(max_length=254, verbose_name='First name')),
                ('lastname', models.CharField(max_length=254, verbose_name='Last name')),
            ],
            options={
                'verbose_name': 'Book author',
                'verbose_name_plural': 'Book authors',
                'ordering': ('-id',),
                'unique_together': {('firstname', 'lastname')},
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=254, verbose_name='Book name')),
                ('picture', models.ImageField(blank=True, null=True, upload_to='', verbose_name='Book picture')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to='viewer.bookauthor', verbose_name='Book author')),
                ('bookcase_slot', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='book', to='viewer.bookcaseslot', verbose_name='Bookcase slot')),
            ],
            options={
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
                'ordering': ('-id',),
            },
        ),
    ]
