# Generated by Django 3.0.7 on 2020-11-03 00:05

import bookwyrm.models.connector
import bookwyrm.models.site
from django.conf import settings
import django.contrib.postgres.operations
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.expressions
import django.utils.timezone
from django.contrib.postgres.fields import JSONField, ArrayField
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ("bookwyrm", "0005_auto_20200221_1645"),
    ]

    operations = [
        migrations.AlterField(
            model_name="tag",
            name="identifier",
            field=models.CharField(max_length=100),
        ),
        migrations.AddConstraint(
            model_name="userrelationship",
            constraint=models.UniqueConstraint(
                fields=("user_subject", "user_object"), name="followers_unique"
            ),
        ),
        migrations.RemoveField(
            model_name="user",
            name="followers",
        ),
        migrations.AddField(
            model_name="status",
            name="published_date",
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.CreateModel(
            name="Edition",
            fields=[
                (
                    "book_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Book",
                    ),
                ),
                ("isbn", models.CharField(max_length=255, null=True, unique=True)),
                (
                    "oclc_number",
                    models.CharField(max_length=255, null=True, unique=True),
                ),
                ("pages", models.IntegerField(null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.book",),
        ),
        migrations.CreateModel(
            name="Work",
            fields=[
                (
                    "book_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Book",
                    ),
                ),
                ("lccn", models.CharField(max_length=255, null=True, unique=True)),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.book",),
        ),
        migrations.RemoveField(
            model_name="author",
            name="data",
        ),
        migrations.RemoveField(
            model_name="book",
            name="added_by",
        ),
        migrations.RemoveField(
            model_name="book",
            name="data",
        ),
        migrations.AddField(
            model_name="author",
            name="bio",
            field=models.TextField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="born",
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="died",
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="first_name",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="last_name",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="name",
            field=models.CharField(default="Unknown", max_length=255),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="author",
            name="wikipedia_link",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="description",
            field=models.TextField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="first_published_date",
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="language",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="last_sync_date",
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.AddField(
            model_name="book",
            name="librarything_key",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.AddField(
            model_name="book",
            name="local_edits",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="book",
            name="local_key",
            field=models.CharField(default=uuid.uuid4, max_length=255, unique=True),
        ),
        migrations.AddField(
            model_name="book",
            name="misc_identifiers",
            field=JSONField(null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="origin",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.AddField(
            model_name="book",
            name="published_date",
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="series",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="series_number",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="sort_title",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="subtitle",
            field=models.TextField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="sync",
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name="book",
            name="title",
            field=models.CharField(default="Unknown", max_length=255),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name="author",
            name="openlibrary_key",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="openlibrary_key",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.AddField(
            model_name="book",
            name="parent_work",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.Work",
            ),
        ),
        migrations.CreateModel(
            name="Notification",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("read", models.BooleanField(default=False)),
                ("notification_type", models.CharField(max_length=255)),
                (
                    "related_book",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="bookwyrm.Book",
                    ),
                ),
                (
                    "related_status",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="bookwyrm.Status",
                    ),
                ),
                (
                    "related_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="related_user",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="author",
            name="aliases",
            field=bookwyrm.models.fields.ArrayField(
                base_field=models.CharField(max_length=255),
                blank=True,
                default=list,
                size=None,
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="manually_approves_followers",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="status",
            name="remote_id",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.CreateModel(
            name="UserBlocks",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("relationship_id", models.CharField(max_length=100)),
                (
                    "user_object",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userblocks_user_object",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_subject",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userblocks_user_subject",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="UserFollowRequest",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("relationship_id", models.CharField(max_length=100)),
                (
                    "user_object",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userfollowrequest_user_object",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_subject",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userfollowrequest_user_subject",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="UserFollows",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("relationship_id", models.CharField(max_length=100)),
                (
                    "user_object",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userfollows_user_object",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user_subject",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="userfollows_user_subject",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.DeleteModel(
            name="UserRelationship",
        ),
        migrations.AddField(
            model_name="user",
            name="blocks",
            field=models.ManyToManyField(
                related_name="blocked_by",
                through="bookwyrm.UserBlocks",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="follow_requests",
            field=models.ManyToManyField(
                related_name="follower_requests",
                through="bookwyrm.UserFollowRequest",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="following",
            field=models.ManyToManyField(
                related_name="followers",
                through="bookwyrm.UserFollows",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddConstraint(
            model_name="userfollows",
            constraint=models.UniqueConstraint(
                fields=("user_subject", "user_object"), name="userfollows_unique"
            ),
        ),
        migrations.AddConstraint(
            model_name="userfollowrequest",
            constraint=models.UniqueConstraint(
                fields=("user_subject", "user_object"), name="userfollowrequest_unique"
            ),
        ),
        migrations.AddConstraint(
            model_name="userblocks",
            constraint=models.UniqueConstraint(
                fields=("user_subject", "user_object"), name="userblocks_unique"
            ),
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("FAVORITE", "Favorite"),
                    ("REPLY", "Reply"),
                    ("TAG", "Tag"),
                    ("FOLLOW", "Follow"),
                    ("FOLLOW_REQUEST", "Follow Request"),
                ],
                max_length=255,
            ),
        ),
        migrations.AddConstraint(
            model_name="notification",
            constraint=models.CheckConstraint(
                check=models.Q(
                    notification_type__in=[
                        "FAVORITE",
                        "REPLY",
                        "TAG",
                        "FOLLOW",
                        "FOLLOW_REQUEST",
                    ]
                ),
                name="notification_type_valid",
            ),
        ),
        migrations.AddConstraint(
            model_name="userblocks",
            constraint=models.CheckConstraint(
                check=models.Q(
                    _negated=True,
                    user_subject=django.db.models.expressions.F("user_object"),
                ),
                name="userblocks_no_self",
            ),
        ),
        migrations.AddConstraint(
            model_name="userfollowrequest",
            constraint=models.CheckConstraint(
                check=models.Q(
                    _negated=True,
                    user_subject=django.db.models.expressions.F("user_object"),
                ),
                name="userfollowrequest_no_self",
            ),
        ),
        migrations.AddConstraint(
            model_name="userfollows",
            constraint=models.CheckConstraint(
                check=models.Q(
                    _negated=True,
                    user_subject=django.db.models.expressions.F("user_object"),
                ),
                name="userfollows_no_self",
            ),
        ),
        migrations.AddField(
            model_name="favorite",
            name="remote_id",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.CreateModel(
            name="Comment",
            fields=[
                (
                    "status_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Status",
                    ),
                ),
                ("name", models.CharField(max_length=255)),
                (
                    "book",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Book"
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.status",),
        ),
        migrations.CreateModel(
            name="Connector",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("identifier", models.CharField(max_length=255, unique=True)),
                (
                    "connector_file",
                    models.CharField(
                        choices=[
                            ("openlibrary", "Openlibrary"),
                            ("bookwyrm", "BookWyrm"),
                        ],
                        default="openlibrary",
                        max_length=255,
                    ),
                ),
                ("is_self", models.BooleanField(default=False)),
                ("api_key", models.CharField(max_length=255, null=True)),
                ("base_url", models.CharField(max_length=255)),
                ("covers_url", models.CharField(max_length=255)),
                ("search_url", models.CharField(max_length=255, null=True)),
                ("key_name", models.CharField(max_length=255)),
                ("politeness_delay", models.IntegerField(null=True)),
                ("max_query_count", models.IntegerField(null=True)),
                ("query_count", models.IntegerField(default=0)),
                ("query_count_expiry", models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.RenameField(
            model_name="book",
            old_name="local_key",
            new_name="fedireads_key",
        ),
        migrations.RenameField(
            model_name="book",
            old_name="origin",
            new_name="source_url",
        ),
        migrations.RemoveField(
            model_name="book",
            name="local_edits",
        ),
        migrations.AddConstraint(
            model_name="connector",
            constraint=models.CheckConstraint(
                check=models.Q(
                    connector_file__in=bookwyrm.models.connector.ConnectorFiles
                ),
                name="connector_file_valid",
            ),
        ),
        migrations.AddField(
            model_name="book",
            name="connector",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.Connector",
            ),
        ),
        migrations.AddField(
            model_name="book",
            name="subject_places",
            field=ArrayField(
                base_field=models.CharField(max_length=255),
                blank=True,
                default=list,
                size=None,
            ),
        ),
        migrations.AddField(
            model_name="book",
            name="subjects",
            field=ArrayField(
                base_field=models.CharField(max_length=255),
                blank=True,
                default=list,
                size=None,
            ),
        ),
        migrations.AddField(
            model_name="edition",
            name="publishers",
            field=ArrayField(
                base_field=models.CharField(max_length=255),
                blank=True,
                default=list,
                size=None,
            ),
        ),
        migrations.AlterField(
            model_name="connector",
            name="connector_file",
            field=models.CharField(
                choices=[
                    ("openlibrary", "Openlibrary"),
                    ("fedireads_connector", "Fedireads Connector"),
                ],
                default="openlibrary",
                max_length=255,
            ),
        ),
        migrations.RemoveField(
            model_name="connector",
            name="is_self",
        ),
        migrations.AlterField(
            model_name="connector",
            name="connector_file",
            field=models.CharField(
                choices=[
                    ("openlibrary", "Openlibrary"),
                    ("self_connector", "Self Connector"),
                    ("fedireads_connector", "Fedireads Connector"),
                ],
                default="openlibrary",
                max_length=255,
            ),
        ),
        migrations.AddField(
            model_name="book",
            name="sync_cover",
            field=models.BooleanField(default=True),
        ),
        migrations.AlterField(
            model_name="author",
            name="born",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="author",
            name="died",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="fedireads_key",
            field=models.CharField(default=uuid.uuid4, max_length=255, unique=True),
        ),
        migrations.AlterField(
            model_name="author",
            name="first_name",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="author",
            name="last_name",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="author",
            name="openlibrary_key",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="first_published_date",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="book",
            name="goodreads_key",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="language",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="librarything_key",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="openlibrary_key",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="published_date",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="sort_title",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="subtitle",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="edition",
            name="isbn",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="edition",
            name="oclc_number",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="edition",
            name="pages",
            field=models.IntegerField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="edition",
            name="physical_format",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="work",
            name="lccn",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="federatedserver",
            name="application_version",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="book",
            name="last_sync_date",
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.AlterField(
            model_name="status",
            name="published_date",
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.CreateModel(
            name="Boost",
            fields=[
                (
                    "status_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Status",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.status",),
        ),
        migrations.RemoveConstraint(
            model_name="notification",
            name="notification_type_valid",
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("FAVORITE", "Favorite"),
                    ("REPLY", "Reply"),
                    ("TAG", "Tag"),
                    ("FOLLOW", "Follow"),
                    ("FOLLOW_REQUEST", "Follow Request"),
                    ("BOOST", "Boost"),
                ],
                max_length=255,
            ),
        ),
        migrations.AddConstraint(
            model_name="notification",
            constraint=models.CheckConstraint(
                check=models.Q(
                    notification_type__in=[
                        "FAVORITE",
                        "REPLY",
                        "TAG",
                        "FOLLOW",
                        "FOLLOW_REQUEST",
                        "BOOST",
                    ]
                ),
                name="notification_type_valid",
            ),
        ),
        migrations.AddField(
            model_name="boost",
            name="boosted_status",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="boosters",
                to="bookwyrm.Status",
            ),
        ),
        migrations.RemoveField(
            model_name="book",
            name="language",
        ),
        migrations.RemoveField(
            model_name="book",
            name="parent_work",
        ),
        migrations.RemoveField(
            model_name="book",
            name="shelves",
        ),
        migrations.AddField(
            model_name="book",
            name="languages",
            field=ArrayField(
                base_field=models.CharField(max_length=255),
                blank=True,
                default=list,
                size=None,
            ),
        ),
        migrations.AddField(
            model_name="edition",
            name="default",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="edition",
            name="parent_work",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.Work",
            ),
        ),
        migrations.AddField(
            model_name="edition",
            name="shelves",
            field=models.ManyToManyField(
                through="bookwyrm.ShelfBook", to="bookwyrm.Shelf"
            ),
        ),
        migrations.AlterField(
            model_name="comment",
            name="book",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Edition"
            ),
        ),
        migrations.AlterField(
            model_name="notification",
            name="related_book",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.Edition",
            ),
        ),
        migrations.AlterField(
            model_name="review",
            name="book",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Edition"
            ),
        ),
        migrations.AlterField(
            model_name="shelf",
            name="books",
            field=models.ManyToManyField(
                through="bookwyrm.ShelfBook", to="bookwyrm.Edition"
            ),
        ),
        migrations.AlterField(
            model_name="shelfbook",
            name="book",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Edition"
            ),
        ),
        migrations.AlterField(
            model_name="status",
            name="mention_books",
            field=models.ManyToManyField(
                related_name="mention_book", to="bookwyrm.Edition"
            ),
        ),
        migrations.AlterField(
            model_name="tag",
            name="book",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Edition"
            ),
        ),
        migrations.RemoveField(
            model_name="comment",
            name="name",
        ),
        migrations.AlterField(
            model_name="review",
            name="rating",
            field=models.IntegerField(
                blank=True,
                default=None,
                null=True,
                validators=[
                    django.core.validators.MinValueValidator(1),
                    django.core.validators.MaxValueValidator(5),
                ],
            ),
        ),
        migrations.AlterField(
            model_name="review",
            name="name",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.CreateModel(
            name="Quotation",
            fields=[
                (
                    "status_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Status",
                    ),
                ),
                ("quote", models.TextField()),
                (
                    "book",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="bookwyrm.Edition",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.status",),
        ),
        migrations.CreateModel(
            name="ReadThrough",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                ("pages_read", models.IntegerField(blank=True, null=True)),
                ("start_date", models.DateTimeField(blank=True, null=True)),
                ("finish_date", models.DateTimeField(blank=True, null=True)),
                (
                    "book",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.Book"
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="ImportItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("data", JSONField()),
            ],
        ),
        migrations.CreateModel(
            name="ImportJob",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_date",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                ("task_id", models.CharField(max_length=100, null=True)),
            ],
        ),
        migrations.RemoveConstraint(
            model_name="notification",
            name="notification_type_valid",
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("FAVORITE", "Favorite"),
                    ("REPLY", "Reply"),
                    ("TAG", "Tag"),
                    ("FOLLOW", "Follow"),
                    ("FOLLOW_REQUEST", "Follow Request"),
                    ("BOOST", "Boost"),
                    ("IMPORT_RESULT", "Import Result"),
                ],
                max_length=255,
            ),
        ),
        migrations.AddConstraint(
            model_name="notification",
            constraint=models.CheckConstraint(
                check=models.Q(
                    notification_type__in=[
                        "FAVORITE",
                        "REPLY",
                        "TAG",
                        "FOLLOW",
                        "FOLLOW_REQUEST",
                        "BOOST",
                        "IMPORT_RESULT",
                    ]
                ),
                name="notification_type_valid",
            ),
        ),
        migrations.AddField(
            model_name="importjob",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="importitem",
            name="book",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="bookwyrm.Book",
            ),
        ),
        migrations.AddField(
            model_name="importitem",
            name="job",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="items",
                to="bookwyrm.ImportJob",
            ),
        ),
        migrations.RemoveConstraint(
            model_name="notification",
            name="notification_type_valid",
        ),
        migrations.AddField(
            model_name="importitem",
            name="fail_reason",
            field=models.TextField(null=True),
        ),
        migrations.AddField(
            model_name="importitem",
            name="index",
            field=models.IntegerField(default=1),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="notification",
            name="related_import",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.ImportJob",
            ),
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("FAVORITE", "Favorite"),
                    ("REPLY", "Reply"),
                    ("TAG", "Tag"),
                    ("FOLLOW", "Follow"),
                    ("FOLLOW_REQUEST", "Follow Request"),
                    ("BOOST", "Boost"),
                    ("IMPORT", "Import"),
                ],
                max_length=255,
            ),
        ),
        migrations.AddConstraint(
            model_name="notification",
            constraint=models.CheckConstraint(
                check=models.Q(
                    notification_type__in=[
                        "FAVORITE",
                        "REPLY",
                        "TAG",
                        "FOLLOW",
                        "FOLLOW_REQUEST",
                        "BOOST",
                        "IMPORT",
                    ]
                ),
                name="notification_type_valid",
            ),
        ),
        migrations.RenameField(
            model_name="edition",
            old_name="isbn",
            new_name="isbn_13",
        ),
        migrations.AddField(
            model_name="book",
            name="author_text",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="edition",
            name="asin",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="edition",
            name="isbn_10",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="connector",
            name="books_url",
            field=models.CharField(default="https://openlibrary.org", max_length=255),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="connector",
            name="local",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="connector",
            name="name",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="connector",
            name="priority",
            field=models.IntegerField(default=2),
        ),
        migrations.AlterField(
            model_name="connector",
            name="connector_file",
            field=models.CharField(
                choices=[
                    ("openlibrary", "Openlibrary"),
                    ("self_connector", "Self Connector"),
                    ("fedireads_connector", "Fedireads Connector"),
                ],
                max_length=255,
            ),
        ),
        migrations.RemoveField(
            model_name="author",
            name="fedireads_key",
        ),
        migrations.RemoveField(
            model_name="book",
            name="fedireads_key",
        ),
        migrations.RemoveField(
            model_name="book",
            name="source_url",
        ),
        migrations.AddField(
            model_name="author",
            name="last_sync_date",
            field=models.DateTimeField(default=django.utils.timezone.now),
        ),
        migrations.AddField(
            model_name="author",
            name="sync",
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name="book",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="author",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.RemoveField(
            model_name="book",
            name="misc_identifiers",
        ),
        migrations.RemoveField(
            model_name="connector",
            name="key_name",
        ),
        migrations.RemoveField(
            model_name="user",
            name="actor",
        ),
        migrations.AddField(
            model_name="connector",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="federatedserver",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="notification",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="readthrough",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="shelf",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="shelfbook",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="tag",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="userblocks",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="userfollowrequest",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="userfollows",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="favorite",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="status",
            name="remote_id",
            field=models.CharField(max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="user",
            name="remote_id",
            field=models.CharField(max_length=255, null=True, unique=True),
        ),
        migrations.CreateModel(
            name="SiteInvite",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "code",
                    models.CharField(
                        default=bookwyrm.models.site.new_access_code, max_length=32
                    ),
                ),
                ("expiry", models.DateTimeField(blank=True, null=True)),
                ("use_limit", models.IntegerField(blank=True, null=True)),
                ("times_used", models.IntegerField(default=0)),
                (
                    "user",
                    models.ForeignKey(
                        default=1,
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.RemoveField(
            model_name="status",
            name="activity_type",
        ),
        migrations.RemoveField(
            model_name="status",
            name="status_type",
        ),
        migrations.RenameField(
            model_name="user",
            old_name="fedireads_user",
            new_name="bookwyrm_user",
        ),
        migrations.AlterField(
            model_name="connector",
            name="connector_file",
            field=models.CharField(
                choices=[
                    ("openlibrary", "Openlibrary"),
                    ("self_connector", "Self Connector"),
                    ("bookwyrm_connector", "BookWyrm Connector"),
                ],
                max_length=255,
            ),
        ),
        migrations.AlterField(
            model_name="connector",
            name="connector_file",
            field=models.CharField(
                choices=[
                    ("openlibrary", "Openlibrary"),
                    ("self_connector", "Self Connector"),
                    ("bookwyrm_connector", "Bookwyrm Connector"),
                ],
                max_length=255,
            ),
        ),
        migrations.CreateModel(
            name="GeneratedStatus",
            fields=[
                (
                    "status_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.Status",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.status",),
        ),
        migrations.CreateModel(
            name="PasswordReset",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "code",
                    models.CharField(
                        default=bookwyrm.models.site.new_access_code, max_length=32
                    ),
                ),
                (
                    "expiry",
                    models.DateTimeField(
                        default=bookwyrm.models.site.get_passowrd_reset_expiry
                    ),
                ),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.AlterField(
            model_name="user",
            name="email",
            field=models.EmailField(max_length=254, unique=True),
        ),
        migrations.CreateModel(
            name="SiteSettings",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(default="BookWyrm", max_length=100)),
                (
                    "instance_description",
                    models.TextField(default="This instance has no description."),
                ),
                (
                    "code_of_conduct",
                    models.TextField(default="Add a code of conduct here."),
                ),
                ("allow_registration", models.BooleanField(default=True)),
            ],
        ),
        migrations.AlterField(
            model_name="user",
            name="email",
            field=models.EmailField(
                blank=True, max_length=254, verbose_name="email address"
            ),
        ),
        migrations.AddField(
            model_name="status",
            name="deleted",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="status",
            name="deleted_date",
            field=models.DateTimeField(),
        ),
        django.contrib.postgres.operations.TrigramExtension(),
        migrations.RemoveField(
            model_name="userblocks",
            name="relationship_id",
        ),
        migrations.RemoveField(
            model_name="userfollowrequest",
            name="relationship_id",
        ),
        migrations.RemoveField(
            model_name="userfollows",
            name="relationship_id",
        ),
        migrations.AlterField(
            model_name="status",
            name="deleted_date",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="status",
            name="privacy",
            field=models.CharField(
                choices=[
                    ("public", "Public"),
                    ("unlisted", "Unlisted"),
                    ("followers", "Followers"),
                    ("direct", "Direct"),
                ],
                default="public",
                max_length=255,
            ),
        ),
        migrations.AddField(
            model_name="importjob",
            name="include_reviews",
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name="importjob",
            name="privacy",
            field=models.CharField(
                choices=[
                    ("public", "Public"),
                    ("unlisted", "Unlisted"),
                    ("followers", "Followers"),
                    ("direct", "Direct"),
                ],
                default="public",
                max_length=255,
            ),
        ),
        migrations.AlterField(
            model_name="user",
            name="federated_server",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="bookwyrm.FederatedServer",
            ),
        ),
        migrations.RenameModel(
            old_name="GeneratedStatus",
            new_name="GeneratedNote",
        ),
        migrations.AlterField(
            model_name="connector",
            name="api_key",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="connector",
            name="max_query_count",
            field=models.IntegerField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="connector",
            name="name",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="connector",
            name="politeness_delay",
            field=models.IntegerField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="connector",
            name="search_url",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="user",
            name="last_active_date",
            field=models.DateTimeField(auto_now=True),
        ),
        migrations.RemoveConstraint(
            model_name="notification",
            name="notification_type_valid",
        ),
        migrations.AlterField(
            model_name="notification",
            name="notification_type",
            field=models.CharField(
                choices=[
                    ("FAVORITE", "Favorite"),
                    ("REPLY", "Reply"),
                    ("MENTION", "Mention"),
                    ("TAG", "Tag"),
                    ("FOLLOW", "Follow"),
                    ("FOLLOW_REQUEST", "Follow Request"),
                    ("BOOST", "Boost"),
                    ("IMPORT", "Import"),
                ],
                max_length=255,
            ),
        ),
        migrations.AddConstraint(
            model_name="notification",
            constraint=models.CheckConstraint(
                check=models.Q(
                    notification_type__in=[
                        "FAVORITE",
                        "REPLY",
                        "MENTION",
                        "TAG",
                        "FOLLOW",
                        "FOLLOW_REQUEST",
                        "BOOST",
                        "IMPORT",
                    ]
                ),
                name="notification_type_valid",
            ),
        ),
    ]
