Adds migration and more tests
This commit is contained in:
parent
5e42afd85a
commit
61caeed5a3
3 changed files with 106 additions and 3 deletions
25
bookwyrm/migrations/0183_auto_20231105_1607.py
Normal file
25
bookwyrm/migrations/0183_auto_20231105_1607.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 3.2.20 on 2023-11-05 16:07
|
||||
|
||||
from django.db import migrations
|
||||
from bookwyrm.models import User
|
||||
|
||||
|
||||
def erase_deleted_user_data(apps, schema_editor):
|
||||
"""Retroactively clear user data"""
|
||||
for user in User.get_permanently_deleted_users():
|
||||
user.erase_user_data()
|
||||
user.save(broadcast=False)
|
||||
user.erase_user_statuses(broadcast=False)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0182_auto_20231027_1122"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
erase_deleted_user_data, reverse_code=migrations.RunPython.noop
|
||||
)
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue