# Generated by Django 2.1.4 on 2019-01-23 08:09

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='AuthorList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author_name', models.CharField(max_length=255, verbose_name='Επωνυμία Συγγραφέα')),
                ('bio', models.TextField(blank=True, verbose_name='Βιογραφικό/Πληροφορίες')),
                ('email', models.EmailField(blank=True, max_length=100, unique=True, verbose_name='Email')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('books', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Συγγραφέας',
                'verbose_name_plural': 'Συγγραφείς',
                'db_table': 'author_list',
                'ordering': ['author_name'],
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='CategoryList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=100, verbose_name='Περιγραφή Κατηγορίας')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('books', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Κατηγορία Βιβλίου',
                'verbose_name_plural': 'Κατηγορίες Βιβλίων',
                'db_table': 'category_list',
                'ordering': ['description'],
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='LanguageList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=50, verbose_name='Περιγραφή γλώσσας')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('books', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Γλώσσα',
                'verbose_name_plural': 'Γλώσσες',
                'db_table': 'language_list',
                'ordering': ['description'],
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='PublisherList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pub_name', models.CharField(max_length=255, verbose_name='Επωνυμία')),
                ('city', models.CharField(blank=True, max_length=100, verbose_name='Πόλη')),
                ('address', models.CharField(blank=True, max_length=100, verbose_name='Διεύθυνση')),
                ('zip', models.CharField(blank=True, max_length=20, verbose_name='Ταχ. Κώδικας')),
                ('phone', models.CharField(blank=True, max_length=50, verbose_name='Τηλέφωνο')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('books', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Εκδοτικός Οίκος',
                'verbose_name_plural': 'Εκδοτικοί Οίκοι',
                'db_table': 'publisher_list',
                'ordering': ['pub_name'],
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='UserData',
            fields=[
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='user_data', serialize=False, to=settings.AUTH_USER_MODEL)),
                ('lends', models.PositiveIntegerField(default=0)),
                ('comments', models.PositiveIntegerField(default=0)),
                ('holds', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Χρήστης',
                'verbose_name_plural': 'Χρήστες',
                'db_table': 'user_data',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author_name', models.CharField(max_length=255, verbose_name='Επωνυμία Συγγραφέα')),
                ('bio', models.TextField(blank=True, verbose_name='Βιογραφικό/Πληροφορίες')),
                ('email', models.EmailField(blank=True, max_length=100, verbose_name='Email')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Συγγραφέας',
                'verbose_name_plural': 'Συγγραφείς',
                'db_table': 'author',
                'ordering': ['author_name'],
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, verbose_name='Τίτλος βιβλίου')),
                ('isbn', models.CharField(blank=True, max_length=50, verbose_name='ISBN')),
                ('pages', models.PositiveSmallIntegerField(default=0, verbose_name='Αριθμός σελίδων')),
                ('dimensions', models.CharField(blank=True, max_length=50, verbose_name='Διαστάσεις')),
                ('weight', models.PositiveIntegerField(blank=True, null=True, verbose_name='Βάρος (γραμμάρια)')),
                ('published_year', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='Έτος έκδοσης')),
                ('published_month', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='Μήνας έκδοσης')),
                ('revision', models.PositiveSmallIntegerField(default=1, verbose_name='Αριθμός έκδοσης')),
                ('abstract', models.TextField(blank=True, verbose_name='Περίληψη')),
                ('image', models.ImageField(default='default_book.png', upload_to='book_covers', verbose_name='Εξώφυλλο')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Δημιουργία')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Τροποποίηση')),
            ],
            options={
                'verbose_name': 'Βιβλίο',
                'verbose_name_plural': 'Βιβλία',
                'db_table': 'book',
                'ordering': ['title'],
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=100, verbose_name='Περιγραφή Κατηγορίας')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Κατηγορία Βιβλίου',
                'verbose_name_plural': 'Κατηγορίες Βιβλίων',
                'db_table': 'category',
                'ordering': ['description'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('stars', models.PositiveSmallIntegerField(choices=[(1, '1 αστέρι'), (2, '2 αστέρια'), (3, '3 αστέρια'), (4, '4 αστέρια'), (5, '5 αστέρια')], default=0, verbose_name='Αξιολόγηση')),
                ('body', models.TextField(blank=True, verbose_name='Σχόλια')),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now, null=True, verbose_name='Ημερομηνία καταχώρησης')),
                ('updated_at', models.DateTimeField(auto_now=True, null=True)),
            ],
            options={
                'db_table': 'comment',
            },
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=2, unique=True, verbose_name='Κωδικός Χώρας')),
                ('description', models.CharField(max_length=100, verbose_name='Περιγραφή Χώρας')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True, null=True)),
            ],
            options={
                'verbose_name': 'Χώρα',
                'verbose_name_plural': 'Χώρες',
                'db_table': 'country',
                'ordering': ['description'],
            },
        ),
        migrations.CreateModel(
            name='Entry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('entry_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Ημερομηνία εισαγωγής')),
                ('classification', models.CharField(blank=True, max_length=255, verbose_name='Πληροφορίες ταξινόμησης')),
                ('cancel_date', models.DateTimeField(blank=True, null=True, verbose_name='Ημερομηνία ακύρωσης')),
                ('notes', models.TextField(blank=True, verbose_name='Σημειώσεις')),
            ],
            options={
                'verbose_name': 'Εισαγωγή',
                'verbose_name_plural': 'Εισαγωγές',
                'db_table': 'entry',
                'ordering': ['-entry_date'],
            },
        ),
        migrations.CreateModel(
            name='Hold',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Ημερομηνία κράτησης')),
            ],
            options={
                'verbose_name': 'Κράτηση',
                'verbose_name_plural': 'Κρατήσεις',
                'db_table': 'hold',
                'ordering': ['book'],
            },
        ),
        migrations.CreateModel(
            name='HoldStatus',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False)),
                ('description', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Κατάσταση Κρατήσεων',
                'verbose_name_plural': 'Καταστάσεις Κρατήσεων',
                'db_table': 'hold_status',
                'ordering': ['description'],
            },
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=50, verbose_name='Περιγραφή γλώσσας')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Γλώσσα',
                'verbose_name_plural': 'Γλώσσες',
                'db_table': 'language',
                'ordering': ['description'],
            },
        ),
        migrations.CreateModel(
            name='Lend',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lend_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Ημερομηνία δανεισμού')),
                ('lend_days', models.PositiveSmallIntegerField(default=20, verbose_name='Διάρκεια δανεισμού (μέρες)')),
                ('return_date', models.DateTimeField(blank=True, null=True, verbose_name='Ημερομηνία επιστροφής')),
            ],
            options={
                'verbose_name': 'Δανεισμός',
                'verbose_name_plural': 'Δανεισμοί',
                'db_table': 'lend',
                'ordering': ['-lend_date'],
            },
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pub_name', models.CharField(max_length=255, verbose_name='Επωνυμία')),
                ('city', models.CharField(blank=True, max_length=100, verbose_name='Πόλη')),
                ('address', models.CharField(blank=True, max_length=100, verbose_name='Διεύθυνση')),
                ('zip', models.CharField(blank=True, max_length=20, verbose_name='Ταχ. Κώδικας')),
                ('phone', models.CharField(blank=True, max_length=50, verbose_name='Τηλέφωνο')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('country', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mainapp.Country', verbose_name='Χώρα')),
            ],
            options={
                'verbose_name': 'Εκδοτικός Οίκος',
                'verbose_name_plural': 'Εκδοτικοί Οίκοι',
                'db_table': 'publisher',
                'ordering': ['pub_name'],
            },
        ),
        migrations.CreateModel(
            name='BookData',
            fields=[
                ('book', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='book_data', serialize=False, to='mainapp.Book')),
                ('active_holds', models.PositiveIntegerField(default=0)),
                ('num_entries', models.PositiveIntegerField(default=0)),
                ('total_lends', models.PositiveIntegerField(default=0)),
                ('active_lends', models.PositiveIntegerField(default=0)),
                ('available', models.PositiveIntegerField(default=0)),
                ('num_comments', models.PositiveIntegerField(default=0)),
                ('num_stars1', models.PositiveIntegerField(default=0)),
                ('num_stars2', models.PositiveIntegerField(default=0)),
                ('num_stars3', models.PositiveIntegerField(default=0)),
                ('num_stars4', models.PositiveIntegerField(default=0)),
                ('num_stars5', models.PositiveIntegerField(default=0)),
                ('sum_stars', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Βιβλίο',
                'verbose_name_plural': 'Βιβλία',
                'db_table': 'book_data',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='BookNewest',
            fields=[
                ('book', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='book_newest', serialize=False, to='mainapp.Book')),
            ],
            options={
                'db_table': 'book_newest',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='BookTopPicks',
            fields=[
                ('book', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='book_best_choices', serialize=False, to='mainapp.Book')),
            ],
            options={
                'db_table': 'book_best_choices',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='BookTopTitles',
            fields=[
                ('book', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='book_top_titles', serialize=False, to='mainapp.Book')),
            ],
            options={
                'db_table': 'book_top_titles',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='LendData',
            fields=[
                ('lend', models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, related_name='lend_data', serialize=False, to='mainapp.Lend')),
                ('delay', models.PositiveIntegerField(default=0)),
            ],
            options={
                'db_table': 'lend_data',
                'managed': False,
            },
        ),
        migrations.AddField(
            model_name='lend',
            name='entry',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mainapp.Entry', verbose_name='Αριθμός αντιτύπου'),
        ),
        migrations.AddField(
            model_name='lend',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='Όνομα χρήστη'),
        ),
        migrations.AddField(
            model_name='hold',
            name='book',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mainapp.Book'),
        ),
        migrations.AddField(
            model_name='hold',
            name='lend',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='hold', to='mainapp.Lend'),
        ),
        migrations.AddField(
            model_name='hold',
            name='status',
            field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.PROTECT, to='mainapp.HoldStatus'),
        ),
        migrations.AddField(
            model_name='hold',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='Χρήστης'),
        ),
        migrations.AddField(
            model_name='entry',
            name='book',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mainapp.Book'),
        ),
        migrations.AddField(
            model_name='entry',
            name='lends',
            field=models.ManyToManyField(related_name='lends', through='mainapp.Lend', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='comment',
            name='book',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mainapp.Book'),
        ),
        migrations.AddField(
            model_name='comment',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Όνομα χρήστη'),
        ),
        migrations.AddField(
            model_name='book',
            name='authors',
            field=models.ManyToManyField(related_name='books', to='mainapp.Author', verbose_name='Συγγραφείς'),
        ),
        migrations.AddField(
            model_name='book',
            name='categories',
            field=models.ManyToManyField(related_name='books', to='mainapp.Category', verbose_name='Κατηγορίες'),
        ),
        migrations.AddField(
            model_name='book',
            name='comments',
            field=models.ManyToManyField(related_name='user_comments', through='mainapp.Comment', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='book',
            name='holds',
            field=models.ManyToManyField(related_name='user_holds', through='mainapp.Hold', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='book',
            name='language',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='books', to='mainapp.Language', verbose_name='Γλώσσα'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='books', to='mainapp.Publisher', verbose_name='Εκδότης'),
        ),
    ]
