# Generated by Django 2.0 on 2018-08-16 11:50

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ChatRecord',
            fields=[
                ('msg_id', models.AutoField(primary_key=True, serialize=False)),
                ('content', models.CharField(max_length=256)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '聊天记录',
                'verbose_name_plural': '聊天记录',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '收藏记录',
                'verbose_name_plural': '收藏记录',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='Follow',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '关注者',
                'verbose_name_plural': '关注者',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='Goods',
            fields=[
                ('goods_id', models.AutoField(primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=30)),
                ('description', models.CharField(max_length=3000)),
                ('picture', models.TextField()),
                ('sale_way', models.PositiveSmallIntegerField(choices=[(0, '一口价'), (1, '拍卖')])),
                ('is_new', models.BooleanField(choices=[(0, '非全新'), (1, '全新')])),
                ('fixed_price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('purchase_price', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)),
                ('status', models.PositiveSmallIntegerField(choices=[(0, '未出售'), (1, '交易中'), (2, '已出售')])),
                ('visits', models.PositiveIntegerField(default=0)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '商品标题',
                'verbose_name_plural': '商品标题',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='GoodsMessage',
            fields=[
                ('msg_id', models.AutoField(primary_key=True, serialize=False)),
                ('content', models.CharField(max_length=256)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
                ('goods_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.Goods')),
            ],
            options={
                'verbose_name': '商品留言',
                'verbose_name_plural': '商品留言',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='GoodsType',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=20, unique=True)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '物品分类',
                'verbose_name_plural': '物品分类',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='Permission',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('permission_no', models.CharField(max_length=255, unique=True)),
                ('permission_name', models.CharField(blank=True, max_length=255)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '权限',
                'verbose_name_plural': '权限',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('role_name', models.CharField(max_length=255)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
                ('role_permission', models.TextField(choices=[('normal_user', '普通用户')], default='普通用户')),
            ],
            options={
                'verbose_name': '角色',
                'verbose_name_plural': '角色',
                'ordering': ['-create_at'],
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('avatar', models.CharField(max_length=2083)),
                ('real_name', models.CharField(max_length=20)),
                ('student_id', models.CharField(max_length=11)),
                ('card_id', models.CharField(max_length=18)),
                ('sex', models.PositiveSmallIntegerField(choices=[(0, '男'), (1, '女')])),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('name', models.CharField(max_length=20, unique=True)),
                ('password', models.CharField(max_length=256)),
                ('create_at', models.DateTimeField(auto_now_add=True)),
                ('update_at', models.DateTimeField(auto_now=True)),
                ('role_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.Role')),
            ],
            options={
                'verbose_name': '用户',
                'verbose_name_plural': '用户',
                'ordering': ['-create_at'],
            },
        ),
        migrations.AddField(
            model_name='goodsmessage',
            name='recv_user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='it_recv_this_message', to='app_db.User'),
        ),
        migrations.AddField(
            model_name='goodsmessage',
            name='send_user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='it_send_this_message', to='app_db.User'),
        ),
        migrations.AddField(
            model_name='goods',
            name='customer_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.User'),
        ),
        migrations.AddField(
            model_name='goods',
            name='goods_type_id',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app_db.GoodsType'),
        ),
        migrations.AddField(
            model_name='follow',
            name='fans_user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='its_fans', to='app_db.User'),
        ),
        migrations.AddField(
            model_name='follow',
            name='user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='it_love', to='app_db.User'),
        ),
        migrations.AddField(
            model_name='collection',
            name='goods_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.Goods'),
        ),
        migrations.AddField(
            model_name='collection',
            name='user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.User'),
        ),
        migrations.AddField(
            model_name='chatrecord',
            name='goods_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app_db.Goods'),
        ),
        migrations.AddField(
            model_name='chatrecord',
            name='recv_user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='it_recv_this_record', to='app_db.User'),
        ),
        migrations.AddField(
            model_name='chatrecord',
            name='send_user_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='it_send_this_record', to='app_db.User'),
        ),
    ]
