# Generated by Django 2.0.1 on 2018-01-21 07:44

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('mbu_is_login', models.BooleanField(default=False, verbose_name='Login Status')),
                ('mbu_status', models.BooleanField(default=True, verbose_name='User Status')),
                ('mbu_avatar', models.ImageField(default='uploads/avatars/default_avatar.jpg', upload_to='uploads/avatars/%Y/%m/%d/%H/%M/%S', verbose_name='Avatar')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'db_table': 'mb_user',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('mbc_id', models.AutoField(primary_key=True, serialize=False, verbose_name='Category ID')),
                ('mbc_name', models.CharField(max_length=20, verbose_name='Category Name')),
                ('mbc_desc', models.CharField(default='', max_length=50, verbose_name='Category Description')),
                ('mbc_order', models.SmallIntegerField(default=0, verbose_name='Category Orders')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
                'db_table': 'mb_category',
                'ordering': ['mbc_order'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('mbc_id', models.CharField(max_length=8, primary_key=True, serialize=False, verbose_name='Comment ID')),
                ('mbc_auther', models.CharField(max_length=20, verbose_name='Auther Name')),
                ('mbc_content', models.TextField(verbose_name='Comment Content')),
                ('mbc_created_at', models.DateTimeField(auto_now_add=True, verbose_name='Create DateTime')),
                ('mbc_last_at', models.DateTimeField(auto_now=True, verbose_name='Last Modify DateTime')),
                ('mbc_publish_opt', models.BooleanField(default=True, verbose_name='Publish Option')),
                ('mbc_upvotes', models.IntegerField(default=0, verbose_name='Up voted times')),
                ('mbc_downvotes', models.IntegerField(default=0, verbose_name='Down voted times')),
                ('mbc_auther_id', models.ForeignKey(db_column='mbc_auther_id', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Auther ID')),
            ],
            options={
                'verbose_name': 'Comment',
                'verbose_name_plural': 'Comment',
                'db_table': 'mb_comment',
                'ordering': ['-mbc_created_at'],
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('mbp_id', models.CharField(max_length=8, primary_key=True, serialize=False, verbose_name='Post ID')),
                ('mbp_title', models.CharField(max_length=100, verbose_name='Post Title')),
                ('mbp_summary', models.TextField(verbose_name='Post Summary')),
                ('mbp_content', models.TextField(verbose_name='Post Content')),
                ('mbp_image', models.ImageField(default='uploads/postimg/default_post.jpg', upload_to='uploads/postimg/%Y/%m/%d/%H/%M/%S', verbose_name='Post Image')),
                ('mbp_auther', models.CharField(max_length=20, verbose_name='Auther Name')),
                ('mbp_created_at', models.DateTimeField(auto_now_add=True, verbose_name='Post Create DateTime')),
                ('mbp_mod_flag', models.BooleanField(default=False, verbose_name='Post modify flag')),
                ('mbp_last_at', models.DateTimeField(auto_now=True, verbose_name='Post last modify datetime')),
                ('mbp_last_by_name', models.CharField(max_length=20, verbose_name='Post last modify name')),
                ('mbp_publish_opt', models.BooleanField(default=True, verbose_name='Post publish option')),
            ],
            options={
                'verbose_name': 'Post',
                'verbose_name_plural': 'Posts',
                'db_table': 'mb_post',
                'ordering': ['-mbp_created_at'],
            },
        ),
        migrations.CreateModel(
            name='Post_Tag',
            fields=[
                ('id', models.AutoField(default=0, primary_key=True, serialize=False)),
                ('mbp_t_created_at', models.DateTimeField(auto_now_add=True, verbose_name='Link Create DateTime')),
            ],
            options={
                'db_table': 'mb_post_tag',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('mbt_id', models.IntegerField(primary_key=True, serialize=False)),
                ('mbt_name', models.CharField(max_length=20)),
                ('mbt_count', models.IntegerField(default=0)),
                ('mbt_status', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tags',
                'db_table': 'mb_tag',
            },
        ),
        migrations.CreateModel(
            name='Post_Static',
            fields=[
                ('mbp_s_pid', models.OneToOneField(db_column='mbp_s_pid', on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='db.Post', verbose_name='Post ID')),
                ('mbp_s_reads', models.IntegerField(default=0, verbose_name='Read times')),
                ('mbp_s_comments', models.IntegerField(default=0, verbose_name='Commment times')),
                ('mbp_s_upvotes', models.IntegerField(default=0, verbose_name='Up vote times')),
                ('mbp_s_downvotes', models.IntegerField(default=0, verbose_name='Down vote times')),
            ],
            options={
                'verbose_name': 'Post_Statics',
                'verbose_name_plural': 'Post_Statics',
                'db_table': 'mb_post_static',
                'ordering': ['mbp_s_pid'],
            },
        ),
        migrations.AddField(
            model_name='post_tag',
            name='mbp_t_pid',
            field=models.ForeignKey(db_column='mbp_t_pid', on_delete=django.db.models.deletion.CASCADE, to='db.Post', verbose_name='Post ID'),
        ),
        migrations.AddField(
            model_name='post_tag',
            name='mbp_t_tid',
            field=models.ForeignKey(db_column='mbp_t_tid', on_delete=django.db.models.deletion.CASCADE, to='db.Tag', verbose_name='Tag ID'),
        ),
        migrations.AddField(
            model_name='post',
            name='mbp_auther_id',
            field=models.ForeignKey(db_column='mbp_auther_id', on_delete=django.db.models.deletion.CASCADE, related_name='auther', to=settings.AUTH_USER_MODEL, verbose_name='Auther ID'),
        ),
        migrations.AddField(
            model_name='post',
            name='mbp_category',
            field=models.ForeignKey(db_column='mbp_category', on_delete=django.db.models.deletion.CASCADE, to='db.Category', verbose_name='Category ID'),
        ),
        migrations.AddField(
            model_name='post',
            name='mbp_last_by_id',
            field=models.ForeignKey(db_column='mbp_last_by_id', on_delete=django.db.models.deletion.CASCADE, related_name='editor', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
        ),
        migrations.AddField(
            model_name='comment',
            name='mbc_post_id',
            field=models.ForeignKey(db_column='mbc_post_id', on_delete=django.db.models.deletion.CASCADE, to='db.Post', verbose_name='Post ID'),
        ),
        migrations.AddField(
            model_name='comment',
            name='mbc_reply_id',
            field=models.ForeignKey(blank=True, db_column='mbc_reply_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='db.Comment', verbose_name='Comment ID'),
        ),
        migrations.AlterUniqueTogether(
            name='post_tag',
            unique_together={('mbp_t_pid', 'mbp_t_tid')},
        ),
    ]
