# Generated by Django 2.0.5 on 2018-05-21 10:11

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Books',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='最后修改时间')),
                ('name', models.CharField(max_length=30, verbose_name='书名')),
                ('price', models.IntegerField(default=0, verbose_name='价值，单位分')),
                ('desc', models.CharField(default='', max_length=32, verbose_name='描述')),
            ],
            options={
                'verbose_name': '书籍',
                'verbose_name_plural': '书籍',
            },
        ),
        migrations.CreateModel(
            name='BooksCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='最后修改时间')),
                ('name', models.CharField(default='', max_length=30, verbose_name='类别名')),
                ('category_type', models.SmallIntegerField(choices=[(1, '一级类别'), (2, '二级类别'), (3, '三级类别')], verbose_name='类目级别')),
                ('parent_category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sub_cat', to='books.BooksCategory', verbose_name='父类目级别')),
            ],
            options={
                'verbose_name': '类别',
                'verbose_name_plural': '类别',
            },
        ),
        migrations.AddField(
            model_name='books',
            name='category',
            field=models.ForeignKey(db_constraint=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to='books.BooksCategory', verbose_name='类别'),
        ),
    ]
