# Generated by Django 3.2.4 on 2021-07-03 12:02

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='BaseModel',
            fields=[
                ('id', models.BigAutoField(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)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('title', models.CharField(max_length=30, unique=True)),
                ('author', models.CharField(max_length=30)),
                ('date_published', models.DateField()),
                ('publisher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            bases=('library.basemodel',),
        ),
        migrations.CreateModel(
            name='Book_Category',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('book_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='library.book')),
            ],
            bases=('library.basemodel',),
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('firstname', models.CharField(max_length=20)),
                ('lastname', models.CharField(max_length=20)),
                ('age', models.PositiveIntegerField(default=0)),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('type_of_user', models.CharField(choices=[('Staff', 'Staff'), ('Reader', 'Reader')], default='Reader', max_length=20)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            bases=('library.basemodel',),
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('book_name', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='likes', to='library.book')),
                ('liked', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to=settings.AUTH_USER_MODEL)),
            ],
            bases=('library.basemodel',),
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('text', models.TextField(max_length=100)),
                ('book_name', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='library.book')),
                ('publisher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            bases=('library.basemodel',),
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='library.basemodel')),
                ('name', models.CharField(max_length=30, unique=True)),
                ('book_name', models.ManyToManyField(related_name='categories', through='library.Book_Category', to='library.Book')),
                ('publisher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='categories', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'categories',
            },
            bases=('library.basemodel',),
        ),
        migrations.AddField(
            model_name='book_category',
            name='category_name',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='library.category'),
        ),
    ]
