bookwyrm/bookwyrm/migrations/0002_auto_20200219_0816.py
2021-03-08 08:49:10 -08:00

66 lines
2 KiB
Python

# Generated by Django 3.0.3 on 2020-02-19 08:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Favorite",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("content", models.TextField(blank=True, null=True)),
("created_date", models.DateTimeField(auto_now_add=True)),
(
"status",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to="bookwyrm.Status",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"unique_together": {("user", "status")},
},
),
migrations.AddField(
model_name="status",
name="favorites",
field=models.ManyToManyField(
related_name="user_favorites",
through="bookwyrm.Favorite",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="user",
name="favorites",
field=models.ManyToManyField(
related_name="favorite_statuses",
through="bookwyrm.Favorite",
to="bookwyrm.Status",
),
),
]