# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-07 17:00
from __future__ import unicode_literals

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),
    ]

    operations = [
        migrations.CreateModel(
            name='BBSCourse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('C_Name', models.CharField(max_length=100)),
                ('C_SeqNum', models.CharField(blank=True, max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='BBSPost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('P_Type', models.IntegerField(default=0)),
                ('P_Title', models.CharField(blank=True, max_length=100)),
                ('P_Content', models.TextField()),
                ('P_Time', models.DateTimeField(default=django.utils.timezone.now)),
                ('P_LastComTime', models.DateTimeField(default=django.utils.timezone.now)),
                ('P_LikeNum', models.IntegerField(default=0)),
                ('P_Section', models.IntegerField(default=1)),
                ('P_ReplyNum', models.IntegerField(default=0)),
                ('P_Top', models.IntegerField(default=0)),
                ('P_Course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSCourse')),
                ('P_Parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='web.BBSPost')),
            ],
        ),
        migrations.CreateModel(
            name='BBSUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('U_studentid', models.CharField(max_length=15)),
                ('U_password', models.CharField(max_length=100)),
                ('U_name', models.CharField(blank=True, max_length=50)),
                ('U_RealName', models.CharField(blank=True, max_length=50)),
                ('U_Major', models.TextField(blank=True)),
                ('U_Description', models.TextField(blank=True, null=True)),
                ('U_Image', models.ImageField(blank=True, null=True, upload_to='')),
                ('U_Identity', models.IntegerField(default=1)),
                ('U_Level', models.IntegerField(default=0)),
                ('U_GPB', models.IntegerField(default=0)),
                ('U_FollowUserNum', models.IntegerField(default=0)),
                ('U_FollowPostNum', models.IntegerField(default=0)),
                ('U_PostNum', models.IntegerField(default=0)),
                ('U_QuestionNum', models.IntegerField(default=0)),
                ('U_AnswerNum', models.IntegerField(default=0)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='FollowUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('User1ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='follower', to='web.BBSUser')),
                ('User2ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='followee', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='UserFollowPost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('PostID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSPost')),
                ('UserID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSUser')),
            ],
        ),
        migrations.CreateModel(
            name='UserHasCourse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('CourseID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSCourse')),
                ('UserID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSUser')),
            ],
        ),
        migrations.CreateModel(
            name='UserLikePost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('PostID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSPost')),
                ('UserID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSUser')),
            ],
        ),
        migrations.AddField(
            model_name='bbspost',
            name='P_User',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.BBSUser'),
        ),
    ]
