# Generated by Django 2.2.7 on 2019-12-11 10:48

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='Photo',
            fields=[
                ('photo_id', models.AutoField(max_length=20, primary_key=True, serialize=False, verbose_name='图片编号')),
                ('photo_url', models.CharField(max_length=64, verbose_name='图片路径')),
                ('create_time', models.DateTimeField(auto_now=True, verbose_name='上传时间')),
                ('flag', models.SmallIntegerField(default=0, verbose_name='0为图片，1为视频')),
                ('article_id', models.BigIntegerField(db_index=True, verbose_name='文章编号')),
            ],
            options={
                'verbose_name': '图片',
                'verbose_name_plural': '图片',
                'db_table': 'tb_article_photo',
                'ordering': ['create_time'],
            },
        ),
        migrations.CreateModel(
            name='Point',
            fields=[
                ('point_id', models.AutoField(max_length=20, primary_key=True, serialize=False, verbose_name='点赞编号')),
                ('point_count', models.IntegerField(default=0, verbose_name='点赞数')),
                ('article_id', models.BigIntegerField(db_index=True, verbose_name='文章编号')),
            ],
            options={
                'verbose_name': '点赞表',
                'verbose_name_plural': '点赞表',
                'db_table': 'tb_article_point',
            },
        ),
        migrations.CreateModel(
            name='Type',
            fields=[
                ('type_id', models.AutoField(max_length=4, primary_key=True, serialize=False, verbose_name='类型id')),
                ('type_name', models.CharField(max_length=10, verbose_name='类型名称')),
            ],
            options={
                'verbose_name': '类型',
                'verbose_name_plural': '类型',
                'db_table': 'tb_article_type',
            },
        ),
        migrations.CreateModel(
            name='Record',
            fields=[
                ('record_id', models.BigAutoField(primary_key=True, serialize=False, verbose_name='用户点赞记录编号')),
                ('article_id', models.BigIntegerField(db_index=True, verbose_name='文章编号')),
                ('flag', models.SmallIntegerField(default=1, verbose_name='0为没有点赞，1为已经点赞')),
                ('user_id', models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '用户点赞记录表',
                'verbose_name_plural': '用户点赞记录表',
                'db_table': 'tb_point_record',
            },
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('article_id', models.BigIntegerField(verbose_name='文章编号')),
                ('user_id', models.IntegerField(verbose_name='用户ID')),
                ('create_time', models.DateTimeField(auto_now=True, db_index=True, verbose_name='收藏时间')),
            ],
            options={
                'verbose_name': '收藏',
                'verbose_name_plural': '收藏',
                'db_table': 'tb_article_collection',
                'unique_together': {('article_id', 'user_id')},
            },
        ),
        migrations.CreateModel(
            name='Reply',
            fields=[
                ('reply_id', models.BigAutoField(max_length=20, primary_key=True, serialize=False, verbose_name='回复编号')),
                ('reply_content', models.CharField(max_length=128, verbose_name='回复内容')),
                ('create_time', models.DateTimeField(auto_now=True, verbose_name='回复时间')),
                ('comment_id', models.BigIntegerField(db_index=True, verbose_name='评论ID')),
                ('target_id', models.BigIntegerField(default=0, verbose_name='0为回复了评论ID，其他的为回复id')),
                ('is_delete', models.SmallIntegerField(default=1, verbose_name='0为删除，1为没有删除')),
                ('from_user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='from_user', to=settings.AUTH_USER_MODEL)),
                ('to_user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='to_user', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '回复',
                'verbose_name_plural': '回复',
                'db_table': 'tb_reply',
                'index_together': {('target_id', 'create_time')},
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('comment_id', models.BigAutoField(max_length=20, primary_key=True, serialize=False, verbose_name='评论编号')),
                ('comment_content', models.CharField(max_length=128, verbose_name='评论内容')),
                ('create_time', models.DateTimeField(auto_now=True, verbose_name='评论时间')),
                ('article_id', models.BigIntegerField(verbose_name='文章编号')),
                ('is_delete', models.SmallIntegerField(default=1, verbose_name='0为删除，1为有效')),
                ('user_id', models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '评论',
                'verbose_name_plural': '评论',
                'db_table': 'tb_article_comment',
                'ordering': ['create_time'],
                'index_together': {('article_id', 'create_time')},
            },
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('article_id', models.BigAutoField(max_length=20, primary_key=True, serialize=False, verbose_name='文章编号')),
                ('title', models.CharField(max_length=64, verbose_name='标题')),
                ('content', models.TextField(verbose_name='内容')),
                ('simple_content', models.CharField(max_length=128, verbose_name='简介内容')),
                ('page_view', models.PositiveIntegerField(default=0, verbose_name='阅读数')),
                ('create_time', models.DateTimeField(auto_now=True, verbose_name='发表时间')),
                ('flag', models.SmallIntegerField(default=0, verbose_name='0为草稿，1为发表,2为删除,3仅为新建的文章')),
                ('type_id', models.IntegerField(db_index=True, verbose_name='类型id')),
                ('user_id', models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
                'db_table': 'tb_article',
                'ordering': ['create_time'],
                'index_together': {('flag', 'create_time')},
            },
        ),
    ]
