Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the redirect FilterList on migration #1109

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pydis_site/apps/api/migrations/0092_remove_redirect_filter_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import migrations
from django.apps.registry import Apps
from django.db.backends.base.schema import BaseDatabaseSchemaEditor


def forward(apps: Apps, _: BaseDatabaseSchemaEditor) -> None:
apps.get_model("api", "FilterList").objects.filter(name="redirect").delete()
Copy link
Member Author

@ChrisLovering ChrisLovering Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api.Filter has on_delete set to cascade set on the filter_list_id foreign key, so deleting the FilterList will delete the Filters for that list automatically.



class Migration(migrations.Migration):

dependencies = [
("api", "0091_antispam_filter_list"),
]

operations = [migrations.RunPython(forward)]