# Generated by Django 2.1.4 on 2019-01-06 13:56

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DirectMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sequence', models.IntegerField(verbose_name='連番')),
                ('title', models.CharField(max_length=100, verbose_name='タイトル')),
                ('message', models.TextField(max_length=5000, verbose_name='メッセージ')),
                ('send_datetime', models.DateTimeField(default=datetime.datetime(2019, 1, 6, 13, 56, 45, 691794, tzinfo=utc), verbose_name='送信日時')),
            ],
            options={
                'verbose_name': 'メッセージ',
                'verbose_name_plural': '3.ダイレクトメッセージ',
                'db_table': 'direct_message',
                'get_latest_by': ('from_member', 'to_member', 'sequence'),
            },
        ),
        migrations.CreateModel(
            name='DirectMessageAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sequence', models.IntegerField(verbose_name='連番')),
                ('attachment', models.ImageField(blank=True, null=True, upload_to=WGB.models.get_upload_to, verbose_name='添付ファイル')),
                ('message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='WGB.DirectMessage', verbose_name='メッセージ')),
            ],
            options={
                'verbose_name': 'メッセージ添付ファイル',
                'verbose_name_plural': '添付ファイル',
                'db_table': 'direct_message_attachment',
            },
        ),
        migrations.CreateModel(
            name='ThreadMember',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create', models.BooleanField(default=False, verbose_name='掲示板作成者フラグ')),
            ],
            options={
                'verbose_name': '掲示板参加メンバー',
                'verbose_name_plural': '参加メンバー',
                'db_table': 'thread_member',
            },
        ),
        migrations.CreateModel(
            name='Threads',
            fields=[
                ('thread_no', models.AutoField(primary_key=True, serialize=False, verbose_name='掲示板No')),
                ('thread_title', models.CharField(max_length=100, verbose_name='掲示板タイトル')),
                ('create_date', models.DateTimeField(default=datetime.datetime(2019, 1, 6, 13, 56, 45, 676169, tzinfo=utc), verbose_name='作成日時')),
                ('open_level', models.SmallIntegerField(choices=[(0, '非公開 (参加者のみ閲覧・書き込み可)'), (1, '閲覧のみ (参加者のみ書き込み可)')], verbose_name='公開レベル')),
                ('password', models.CharField(max_length=100, verbose_name='利用パスワード')),
            ],
            options={
                'verbose_name': '掲示板スレッド',
                'verbose_name_plural': '1.掲示板スレッド',
                'db_table': 'threads',
            },
        ),
        migrations.CreateModel(
            name='ThreadWrite',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(verbose_name='書き込み番号')),
                ('sentence', models.TextField(max_length=5000, verbose_name='書き込み')),
                ('write_datetime', models.DateTimeField(default=datetime.datetime(2019, 1, 6, 13, 56, 45, 691794, tzinfo=utc), verbose_name='書き込み日時')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='WGB.ThreadMember', verbose_name='参加メンバー')),
                ('thread', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='WGB.Threads', verbose_name='掲示板スレッド')),
            ],
            options={
                'verbose_name': '掲示板書き込み',
                'verbose_name_plural': '2.掲示板書き込み',
                'db_table': 'thread_write',
                'get_latest_by': 'number',
            },
        ),
        migrations.CreateModel(
            name='ThreadWriteAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sequence', models.IntegerField(verbose_name='連番')),
                ('attachment', models.ImageField(blank=True, null=True, upload_to=WGB.models.get_upload_to, verbose_name='添付画像ファイル')),
                ('thread_write', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='WGB.ThreadWrite', verbose_name='書き込み')),
            ],
            options={
                'verbose_name': '書き込み添付ファイル',
                'verbose_name_plural': '添付ファイル',
                'db_table': 'thread_write_attachment',
            },
        ),
        migrations.CreateModel(
            name='UserAccount',
            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')),
                ('nickname', models.CharField(blank=True, max_length=100, verbose_name='ニックネーム')),
                ('icon', models.ImageField(blank=True, null=True, upload_to=WGB.models.get_upload_to, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'gif', 'png'])], verbose_name='アイコン画像パス')),
                ('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={
                'verbose_name': '利用者アカウント',
                'verbose_name_plural': '0.利用者アカウント',
                'db_table': 'wgb_user_account',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.AddField(
            model_name='threadmember',
            name='member',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='参加メンバー'),
        ),
        migrations.AddField(
            model_name='threadmember',
            name='thread',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='WGB.Threads', verbose_name='掲示板スレッド'),
        ),
        migrations.AddField(
            model_name='directmessage',
            name='from_member',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='from_member', to='WGB.ThreadMember', verbose_name='送信者'),
        ),
        migrations.AddField(
            model_name='directmessage',
            name='to_member',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='to_member', to='WGB.ThreadMember', verbose_name='送信相手'),
        ),
        migrations.AlterUniqueTogether(
            name='threadwriteattachment',
            unique_together={('thread_write', 'sequence')},
        ),
        migrations.AlterUniqueTogether(
            name='threadwrite',
            unique_together={('thread', 'number')},
        ),
        migrations.AlterUniqueTogether(
            name='threadmember',
            unique_together={('thread', 'member')},
        ),
        migrations.AlterUniqueTogether(
            name='directmessageattachment',
            unique_together={('message', 'sequence')},
        ),
        migrations.AlterUniqueTogether(
            name='directmessage',
            unique_together={('from_member', 'to_member', 'sequence')},
        ),
    ]
