New migration file
I don't know why it felt important to do this but it did. The migrations are in one file now and don't need a merge migration.
This commit is contained in:
parent
a718a168a3
commit
c7ecbb2fdf
2 changed files with 6 additions and 19 deletions
132
bookwyrm/migrations/0151_auto_20220705_0049.py
Normal file
132
bookwyrm/migrations/0151_auto_20220705_0049.py
Normal file
|
@ -0,0 +1,132 @@
|
|||
# Generated by Django 3.2.13 on 2022-07-05 00:49
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0150_readthrough_stopped_date'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='notification',
|
||||
name='related_book',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="notification",
|
||||
name="related_groups",
|
||||
field=models.ManyToManyField(
|
||||
related_name="notifications", to="bookwyrm.Group"
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="notification",
|
||||
name="related_list_items",
|
||||
field=models.ManyToManyField(
|
||||
related_name="notifications", to="bookwyrm.ListItem"
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="notification",
|
||||
name="related_reports",
|
||||
field=models.ManyToManyField(to="bookwyrm.Report"),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="notification",
|
||||
name="related_statuses",
|
||||
field=models.ManyToManyField(
|
||||
related_name="notifications", to="bookwyrm.Status"
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="notification",
|
||||
name="related_users",
|
||||
field=models.ManyToManyField(
|
||||
related_name="notifications", to=settings.AUTH_USER_MODEL
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="related_group",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="notifications_temp",
|
||||
to="bookwyrm.group",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="related_list_item",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="notifications_tmp",
|
||||
to="bookwyrm.listitem",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="related_report",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="notifications_tmp",
|
||||
to="bookwyrm.report",
|
||||
),
|
||||
),
|
||||
migrations.RunSQL(
|
||||
sql="""
|
||||
INSERT INTO bookwyrm_notification_related_statuses (notification_id, status_id)
|
||||
SELECT id, related_status_id
|
||||
FROM bookwyrm_notification
|
||||
WHERE bookwyrm_notification.related_status_id IS NOT NULL;
|
||||
|
||||
INSERT INTO bookwyrm_notification_related_users (notification_id, user_id)
|
||||
SELECT id, related_user_id
|
||||
FROM bookwyrm_notification
|
||||
WHERE bookwyrm_notification.related_user_id IS NOT NULL;
|
||||
|
||||
INSERT INTO bookwyrm_notification_related_groups (notification_id, group_id)
|
||||
SELECT id, related_group_id
|
||||
FROM bookwyrm_notification
|
||||
WHERE bookwyrm_notification.related_group_id IS NOT NULL;
|
||||
|
||||
INSERT INTO bookwyrm_notification_related_list_items (notification_id, listitem_id)
|
||||
SELECT id, related_list_item_id
|
||||
FROM bookwyrm_notification
|
||||
WHERE bookwyrm_notification.related_list_item_id IS NOT NULL;
|
||||
|
||||
INSERT INTO bookwyrm_notification_related_reports (notification_id, report_id)
|
||||
SELECT id, related_report_id
|
||||
FROM bookwyrm_notification
|
||||
WHERE bookwyrm_notification.related_report_id IS NOT NULL;
|
||||
|
||||
""",
|
||||
reverse_sql=migrations.RunSQL.noop,
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="notification",
|
||||
name="related_group",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="notification",
|
||||
name="related_list_item",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="notification",
|
||||
name="related_report",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="notification",
|
||||
name="related_status",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="notification",
|
||||
name="related_user",
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue