# Generated by Django 2.1 on 2018-08-04 14:13

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='Board',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hid', models.CharField(db_index=True, max_length=8)),
                ('name', models.CharField(max_length=64)),
                ('url', models.CharField(max_length=16)),
                ('description', models.TextField(blank=True)),
                ('rules', models.TextField(blank=True)),
                ('default_username', models.CharField(max_length=32)),
                ('default_max_posts_num', models.IntegerField()),
                ('is_hidden', models.BooleanField(default=False)),
                ('is_locked', models.BooleanField(default=False)),
                ('is_deleted', models.BooleanField(default=False)),
                ('last_thread_hid', models.IntegerField(null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('original_name', models.CharField(editable=False, max_length=128)),
                ('mimetype', models.CharField(editable=False, max_length=16)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('size', models.IntegerField(editable=False)),
                ('width', models.IntegerField(editable=False)),
                ('height', models.IntegerField(editable=False)),
                ('is_spoiler', models.BooleanField(default=False)),
                ('is_deleted', models.BooleanField(db_index=True, default=False)),
                ('checksum', models.CharField(blank=True, editable=False, max_length=16)),
                ('thumb_width', models.IntegerField(editable=False)),
                ('thumb_height', models.IntegerField(editable=False)),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hid', models.IntegerField(db_index=True, editable=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('text', models.TextField(blank=True, max_length=2048)),
                ('title', models.CharField(blank=True, max_length=64)),
                ('author', models.CharField(blank=True, max_length=32)),
                ('email', models.CharField(blank=True, max_length=32)),
                ('password', models.CharField(blank=True, max_length=16)),
                ('is_op', models.BooleanField(editable=False)),
                ('user_was_warned', models.BooleanField(default=False)),
                ('user_was_banned', models.BooleanField(default=False)),
                ('is_deleted', models.BooleanField(db_index=True, default=False)),
                ('ip_address', models.CharField(db_index=True, editable=False, max_length=16)),
                ('created_by', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('replies', models.ManyToManyField(db_index=True, editable=False, to='imageboard.Post')),
            ],
        ),
        migrations.CreateModel(
            name='Thread',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hid', models.IntegerField(db_index=True, editable=False)),
                ('is_sticky', models.BooleanField(db_index=True, default=False)),
                ('is_locked', models.BooleanField(db_index=True, default=False)),
                ('is_deleted', models.BooleanField(db_index=True, default=False)),
                ('max_posts_num', models.IntegerField()),
                ('last_post_hid', models.IntegerField(null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True, db_index=True)),
                ('board', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='threads', to='imageboard.Board')),
                ('op', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='imageboard.Post')),
            ],
        ),
        migrations.AddField(
            model_name='post',
            name='thread',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='imageboard.Thread'),
        ),
        migrations.AddField(
            model_name='image',
            name='post',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='imageboard.Post'),
        ),
        migrations.AlterUniqueTogether(
            name='thread',
            unique_together={('board', 'hid')},
        ),
        migrations.AlterUniqueTogether(
            name='post',
            unique_together={('thread', 'hid')},
        ),
    ]
