bookwyrm/bookwyrm/migrations/0154_bookauthor.py
Mouse Reeve 4a980cd0e5 Prepares a join table between Book and Author
This will allow any number of good things, like specifying types of
authors. Notice that this join table isn't joined right now -- Django
can't handle that complex a migration.
2022-07-09 14:10:05 -07:00

75 lines
2.5 KiB
Python

# Generated by Django 3.2.14 on 2022-07-09 21:09
import bookwyrm.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0153_merge_20220706_2141"),
]
operations = [
migrations.CreateModel(
name="BookAuthor",
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)),
(
"remote_id",
bookwyrm.models.fields.RemoteIdField(
max_length=255,
null=True,
validators=[bookwyrm.models.fields.validate_remote_id],
),
),
(
"author_type",
models.CharField(
choices=[
("author", "Author"),
("contributor", "Contributor"),
("translator", "Translator"),
("illustrator", "Illustrator"),
("editor", "Editor"),
("Other", "Other"),
],
default="author",
max_length=255,
),
),
(
"author_type_detail",
models.CharField(blank=True, max_length=100, null=True),
),
(
"author",
bookwyrm.models.fields.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="bookwyrm.author",
),
),
(
"book",
bookwyrm.models.fields.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="bookwyrm.book"
),
),
],
options={
"unique_together": {("book", "author", "author_type")},
},
),
]